Rendering of Code

G

Guest

Hello I am having a problem with code not being rendered. I have a checkboxlist that is databinded in the Not Page.IsPostBack() sub, and the visibility is set to true/false depending on certain requirements. If the user modifies the page in a certain way then the checkboxlist will be made visible again using JavaScript code. The problem is, that if I set visible=false in the page load sub, then the code for the checkboxlist never gets rendered on the Html Page, so then the JavaScript will go to enable the visibility of the checkboxlist, but it won't even exist on the page. Does anybody know how to have the visible property set to false and still have the code render on the page?
ThankYou
Ryan
 
P

Patrice

Server Side, the "visible" property means actually that this control is not
"rendered" at all (as a result you won't see any HTML code for this control
client side).

You should hide it instead.

Patrice

--

Ryan Scully said:
Hello I am having a problem with code not being rendered. I have a
checkboxlist that is databinded in the Not Page.IsPostBack() sub, and the
visibility is set to true/false depending on certain requirements. If the
user modifies the page in a certain way then the checkboxlist will be made
visible again using JavaScript code. The problem is, that if I set
visible=false in the page load sub, then the code for the checkboxlist never
gets rendered on the Html Page, so then the JavaScript will go to enable the
visibility of the checkboxlist, but it won't even exist on the page. Does
anybody know how to have the visible property set to false and still have
the code render on the page?
 
K

Kevin Spencer

Sure. Use styles.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

Ryan Scully said:
Hello I am having a problem with code not being rendered. I have a
checkboxlist that is databinded in the Not Page.IsPostBack() sub, and the
visibility is set to true/false depending on certain requirements. If the
user modifies the page in a certain way then the checkboxlist will be made
visible again using JavaScript code. The problem is, that if I set
visible=false in the page load sub, then the code for the checkboxlist never
gets rendered on the Html Page, so then the JavaScript will go to enable the
visibility of the checkboxlist, but it won't even exist on the page. Does
anybody know how to have the visible property set to false and still have
the code render on the page?
 
P

Patrice

Use the "display:none" CSS style and keep the Visible property server side
to True. As a result :
- with Visible set tot True, the HTML code is rendered
- with the "display:none" style, this part is hidden

You can then later use JavaScript to change style.display to '' making
appear the corresponding HTML.

--

Ryan Scully said:
could you please give me some idea of where to start with this? I want to
be able to manipulate the visible property of the checkboxlist in source
code. I guess somehow I'd have to programmatically create a style, then set
the visibility property to false???
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

Forum statistics

Threads
473,781
Messages
2,569,615
Members
45,295
Latest member
EmilG1510

Latest Threads

Top