C# – why does the usercontrol keep resetting it’s visible property to false

asp.netc

Ok, I have a usercontrol on my page.

On the page, the visible property is set to false.

On the OnPreRender event, I set the visible property to true.

It runs the line of code, but does not actually change anything. (so visible remains at false)

This exact same method works across every other control, and there is nothing special about this control.

Any ideas??

Best Answer

Check for the visible property on any controls containing this control.

Setting Visible=True does not mean that Visible==True, it will still return False if a parent control is False.

Other than that though, you may need to post some examples of your code in order for anyone to help track down what the problem may be.

Related Topic