Is it possible to not load a control that's already defined in the mark up
I have a multipurpose page, depending on a QueryString
parameter I can tell how this page is going to be used now.
The difference between the various purposes or functions of this page will result in a little difference of controls shown.
so I was think开发者_Go百科ing to optimize the page I could try to detect the current function of the page in an early even of the page's life cycle and "remove" (remove, hide, whatever works I really dunno and this is my question in the first place) the unnecessary controls and win a bit lighter and faster page.
What do you think =) ?
Yes, that works fine. You can use the Visible
property on web controls to remove them from the output, if you set it to false, it won't render any HTML code to the page.
If you have a bunch of elements to keep from rendering (or a plain HTML element, which doesn't have the Visible
property), you can put a PlaceHolder
control around them, and use the Visible
property on that.
精彩评论