If a Web user control has the visible property set to false, will the control still render?
Thanks for all the quick replies. I do not want the control to render in some cases, so this wa开发者_如何学JAVAs the answer(s) I was looking for.
If you mean Control.Visible
property, not attribute as you mentioned, then yes, it won't be rendered.
on the link above:
Control.Visible Property gets or sets a value that indicates whether a server control is rendered as UI on the page.
If this property is false, the server control is not rendered. You should take this into account when organizing the layout of your page.
No it will not. If you want it to be rendered on page and be invisible, change the control style to make it hidden rather than using the visibility property.
It'll still have viewstate, and it'll still receive server-side life-cycle events, but no -- the control itself won't generate HTML.
No, when visible is set to false nothing at all is sent to the client.
Nope It wont if visible=false
. Visible
property for a web user control works just like the property in the other generic controls.
It will not render.
If you were to set its CSS style display property to none, then it would render but not be visible on screen. But setting the server-side control's visible property to false will not render it at all, and you won't be able to reference it on the client-side.
精彩评论