Last post Apr 17, 2007 01:21 PM by JimAmigo
Apr 17, 2007 11:49 AM|JimAmigo|LINK
I have two controls a hyperlink and label.
For some reason, I can set the visbility of the hyperlink control onload but it doesn't work for a label control. I get....."label does not exist in the current context".
if (securityid == User.SECURITY_LEVEL_ID_AO_dec)
Hyperlink1.Visible = false;
Label1.Visible = false
//Get ERROR on label visiblity setting
Is it because the lable gets rendered elsewhere than the page load? If so where and which event?
Apr 17, 2007 12:45 PM|pkellner|LINK
There must be some other issue. see if you can reduce the size of your page and figure out what is going on. Here is a simple sample that works with label visibility.
Apr 17, 2007 01:04 PM|JimAmigo|LINK
Ok, I put a label control in a regular page and it worked fine. My guess is... is that the page is a content page with a master page for headers and menus?
Apr 17, 2007 01:14 PM|pkellner|LINK
you probably need to do a MasterPage.Findcontrol(...
Take a look at Rick's article on this.
Apr 17, 2007 01:21 PM|JimAmigo|LINK
I answered my own question. I had recently copied a file within the same application. It seems the object control reference gets confused between the new, old file and old file code behind.
Here is where I found the answer...