IIWeb C# Code Not Working - RESOLVED

For sharing any UNIT-e Workstation screens, Web II screens or Advantage II screens and other customisations
Post Reply
ryanfoster659
Posts: 14
Joined: Fri Nov 11, 2016 9:11 am
Forename: Ryan
Surname: Foster
College Name: Strode's
Position: Web/MIS Developer
LinkedIn Profile: https://www.linkedin.com/in/rfoster8?tr ... tity-photo

IIWeb C# Code Not Working - RESOLVED

Post by ryanfoster659 » Fri Nov 18, 2016 10:19 am

I have a customised IIWeb app that has c# code working fine which I wrote but when I try a similar thing with a new link label it fails and nothing works.

Here is my code that isn't currently working and I don't know why:
private UNITeWebLinkLabel unitTeLinkLabel2;


public CodeBehindClass(IIWebClient webClient)
{
object[] uniTeLinkLabel2_Found = webClient.Controls.Find("uniTeLinkLabel2", true);
if (uniTeLinkLabel2_Found.Length > 0)
{
this.uniTeLinkLabel2 = webClient.Controls.Find("uniTeLinkLabel2", true)[0] as UNITeWebLinkLabel;
this.uniTeLinkLabel2.Click += new EventHandler(uniTeLinkLabel2_Click);
}
}

void uniTeLinkLabel2_Click(object sender, EventArgs e)
{
Response.Redirect("www.google.co.uk");
}

The code that does work uses the same code apart from it's onclick handler is validating data before save and that works fine. Add this in and everything falls over.

Any suggestions?

Ryan

ryanfoster659
Posts: 14
Joined: Fri Nov 11, 2016 9:11 am
Forename: Ryan
Surname: Foster
College Name: Strode's
Position: Web/MIS Developer
LinkedIn Profile: https://www.linkedin.com/in/rfoster8?tr ... tity-photo

Re: IIWeb C# Code Not Working

Post by ryanfoster659 » Fri Nov 18, 2016 11:25 am

UPDATE:
I have changed the Response.Redirect to a MessageBox.Show and it is working so does it simply not like you using Response.Redirect??

User avatar
robinwilson16
Site Admin
Posts: 184
Joined: Sun Oct 16, 2016 6:46 pm
Forename: Robin
Surname: Wilson
College Name: FEA
Position: MIS Consultant
LinkedIn Profile: https://www.linkedin.com/in/robinwilson16

Re: IIWeb C# Code Not Working

Post by robinwilson16 » Sun Nov 20, 2016 2:09 pm

Hello Ryan

Thanks for posting your workaround.
Unfortunately we do not have an II Web licence so I can't help with this :( but hopefully someone else will be able to respond. 8-)

Robin

ryanfoster659
Posts: 14
Joined: Fri Nov 11, 2016 9:11 am
Forename: Ryan
Surname: Foster
College Name: Strode's
Position: Web/MIS Developer
LinkedIn Profile: https://www.linkedin.com/in/rfoster8?tr ... tity-photo

Re: IIWeb C# Code Not Working

Post by ryanfoster659 » Tue Feb 14, 2017 12:13 pm

Just a heads up to everyone, if your Code is still not working then open your xml file in notepad and make sure that there is not Partial code tag within it as this will stop your main code from working.... took me a few hours to figure this out.

User avatar
robinwilson16
Site Admin
Posts: 184
Joined: Sun Oct 16, 2016 6:46 pm
Forename: Robin
Surname: Wilson
College Name: FEA
Position: MIS Consultant
LinkedIn Profile: https://www.linkedin.com/in/robinwilson16

Re: IIWeb C# Code Not Working

Post by robinwilson16 » Thu Feb 16, 2017 11:50 pm

Hello Ryan

Thanks for posting the solution so that others won't also need to spend ages trying to figure it out.
:text-bravo:

I will move this to the new II forum I created.

Robin

ryanfoster659
Posts: 14
Joined: Fri Nov 11, 2016 9:11 am
Forename: Ryan
Surname: Foster
College Name: Strode's
Position: Web/MIS Developer
LinkedIn Profile: https://www.linkedin.com/in/rfoster8?tr ... tity-photo

Re: IIWeb C# Code Not Working - RESOLVED

Post by ryanfoster659 » Fri Feb 17, 2017 3:10 pm

Thank you Robin, yeah it was a pain to sort out as Capita don't support code (apparently) so I asked one of the consultants who merely hinted at this so I did have a little help with it :P

Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests