views:

37

answers:

2

I'm working on an old web application in Visual Studio .Net 2003 (yeeich) and I'm having an issue with a Checkbox that will not set the Visibility to True.

It's declared as such:

Protected WithEvents chkTraining As System.Web.UI.WebControls.CheckBox 

and

<asp:CheckBox id="chkTraining" runat="server" Visible="False"></asp:CheckBox>

When I am debugging through the line that has:

chkTraining.Visible = True

it goes past it fine, but as I check this value on the very next line, chkTraining.Visible = False. What could possibly be going on here? There's no events firing off or anything else going on... this really is throwing me for a loop. Thanks for your help.

+2  A: 

It could be that its container's visibility is set to false.

Kant
Man I feel like an idiot, I triple checked this before posting and turned out I was looking at the wrong source code... Helps if you look at the right file first. Thanks.
Shawn Steward
A: 

why declare it? if you are putting it in the .aspx page

<asp:CheckBox id="chkTraining" runat="server" Visible="False"></asp:CheckBox>

access it using the id in the code behind...

Mausimo
It's Visual Studio 2003, I'm pretty sure you have to do it that way. Later versions do it automatically but if you type in the tags and don't drag a control to the form, it won't create the declaration for you.
Shawn Steward
Fair enough, i'm lacking in vs2003 knowledge all i have used is 2005, and 2008 for asp.net (in c#). I never have to declare anything i put in the .aspx page (and have not seen any explicit declarations made from dragging controls onto the .aspx page in the code behind). However in the code behind i can automatically access controls by using the id. Sorry i could not be any help, good luck!
Mausimo