[phpBB Debug] PHP Warning: in file [ROOT]/phpbb/session.php on line 580: sizeof(): Parameter must be an array or an object that implements Countable
[phpBB Debug] PHP Warning: in file [ROOT]/phpbb/session.php on line 636: sizeof(): Parameter must be an array or an object that implements Countable
Unofficial UNIT-e Forum • IIWeb C# Code Not Working - RESOLVED
Page 1 of 1

IIWeb C# Code Not Working - RESOLVED

Posted: Fri Nov 18, 2016 10:19 am
by ryanfoster659
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

Re: IIWeb C# Code Not Working

Posted: Fri Nov 18, 2016 11:25 am
by ryanfoster659
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??

Re: IIWeb C# Code Not Working

Posted: Sun Nov 20, 2016 2:09 pm
by robinwilson16
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

Re: IIWeb C# Code Not Working

Posted: Tue Feb 14, 2017 12:13 pm
by ryanfoster659
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.

Re: IIWeb C# Code Not Working

Posted: Thu Feb 16, 2017 11:50 pm
by robinwilson16
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

Re: IIWeb C# Code Not Working - RESOLVED

Posted: Fri Feb 17, 2017 3:10 pm
by ryanfoster659
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