|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Panels and dynamic controls...againissue. I have a page on which I have 2 panels. Each panel has a DropDownList control which is generated dynamically at init. The first panel (panel1) is visible, while the other panel (panel2) is currently not visible. Just wondering if there is a way around wasting time on creating the controls for panel2, when it is not shown yet? I only want to create it when panel2 becomes visible, but then I get into the classic page cycle problem, where events and viewstates makes it impossible to keep values to the dropdownlist dynamic. Above is the simple solution. After some weeks of development, I have more like 11 panels with alot of controls on each of them. Some dynamic, some hardcoded items. I'm using viewstate and OnPrerender event to determine if a panel should be visible. It works fine, but getting kind of slow when you need to generate ALL controls and bind data at each cycle. If you need to show one panel with one control, it's kind of frustrating that I need to create 100+ controls before I can display that one control. My goal is to keep everything on one aspx page, but not sure if this is the right strategy if you have a rather large site with many functions and controls. Please advise. There must be a better way to design this? One thing you could try is making each Panel into a UserControl (*.ascx) and
then setting the Visible property of that UserControl. You may also be able to use the IsPostBack property in several places to help prevent unnecessary renderings. I haven't done any testing on either of these, but they may help. I wasn't quite sure from your posting, but if you are never showing more than one Panel at a time, you may want to look into the MultiView control. Even if it doesn't make your code more efficient as far as rendering more controls than you will be displaying (maybe it does, I haven't checked), it will definitely make your code more organized if you are only displaying one at a time. I can't promise whether any of this will help, but maybe they will give you some ideas. Good Luck! Show quoteHide quote "PZ" <P*@discussions.microsoft.com> wrote in message news:1318AD86-15EA-4D73-9DF7-98D68062EFAD@microsoft.com... > Sorry for posting again, been away for a while, just need to refresh this > issue. > > I have a page on which I have 2 panels. Each panel has a DropDownList > control which is generated dynamically at init. The first panel (panel1) > is > visible, while the other panel (panel2) is currently not visible. > > Just wondering if there is a way around wasting time on creating the > controls for panel2, when it is not shown yet? I only want to create it > when > panel2 becomes visible, but then I get into the classic page cycle > problem, > where events and viewstates makes it impossible to keep values to the > dropdownlist dynamic. > > Above is the simple solution. After some weeks of development, I have more > like 11 panels with alot of controls on each of them. Some dynamic, some > hardcoded items. I'm using viewstate and OnPrerender event to determine if > a > panel should be visible. It works fine, but getting kind of slow when you > need to generate ALL controls and bind data at each cycle. If you need to > show one panel with one control, it's kind of frustrating that I need to > create 100+ controls before I can display that one control. > > My goal is to keep everything on one aspx page, but not sure if this is > the > right strategy if you have a rather large site with many functions and > controls. > > Please advise. > > There must be a better way to design this? > >
Check for table
Adapting ReorderList WebControl for rendering dynamic html SelectCommand with SelectParameters.Add UpdateProgress animated gif freezes in ajax postback RE: Gridview templaye button control OnClientClick with confirm doesn't work Re: FTP download Validator for checkbox is not getting triggered always RE: SelectCommand with SelectParameters.Add Re: Databinding Syntax Not Working in ListView LayoutTemplate |
|||||||||||||||||||||||