I am trying to generate a div which can be used by client side script to hide or display a section of the page. so what i have done is wrap the content that i want to toggle visibility for in a Panel control:
When the page renders, this pane/div and the contents within are not rendered AT ALL. Why is this? I am just trying to understand if this is common behavior or not. Does not seem intuitive based on the property name if it is.
(To resolve, what i have had to do is instead use the Style property and set the 'display' element to "none";)
When you set the visibility of a control to false, it will not be added to the Page Tree thus it will not be rendered. However, you can use Javascript to set the visibility to false, in this way, you can access to this container on the client side.
dizzy0ny
Member
12 Points
81 Posts
Div or Panel visibility propert of 'false' cause control not to render?
Aug 08, 2008 03:55 AM|LINK
I am trying to generate a div which can be used by client side script to hide or display a section of the page. so what i have done is wrap the content that i want to toggle visibility for in a Panel control:
In the Page_Load method i do the following:
When the page renders, this pane/div and the contents within are not rendered AT ALL. Why is this? I am just trying to understand if this is common behavior or not. Does not seem intuitive based on the property name if it is.
(To resolve, what i have had to do is instead use the Style property and set the 'display' element to "none";)
Haissam
All-Star
37421 Points
5632 Posts
Re: Div or Panel visibility propert of 'false' cause control not to render?
Aug 08, 2008 05:25 AM|LINK
When you set the visibility of a control to false, it will not be added to the Page Tree thus it will not be rendered. However, you can use Javascript to set the visibility to false, in this way, you can access to this container on the client side.
divPanel1.Style.Add("display", "none");
Hope this helps,
MCAD.NET
| Blog |