|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
ListBox not firing SelectedIndexChanged (AutoPostBack=True)To all .Net gurus out there;
I have a simple ASP.Net Form, in which I added a ListBox control. I populate the content of that ListBox at run time. To save on footprint size, I set EnableViewState=False. But by doing that, the SelectedIndexChanged stops working (AutoPostBack is still = True). Any know of this odd behavior? I have a Response.Redirect in my SelectedIndexChanged function, so I have no need to keep EnableViewState=True. And since any click would result in a redirect, I have no need to "re"load the ListBox on page_load if IsPostBack. I know this can be solved by turning EnableViewState = True, but that would also make the rendered HTML & view state blob grow at an exponential rate when listbox contains hundreds of items... Can anyone help? If you rely upon the SelectedIndex change behavior from the DDL, you must
enable viewstate. You can get away with repopulating the items in Page_Init, but the way the DDL knows if it was changed is it stores the last selected index in ViewState. So if you disable it, then it won't work correctly. -Brock DevelopMentor http://staff.develop.com/ballen Show quoteHide quote > To all .Net gurus out there; > > I have a simple ASP.Net Form, in which I added a ListBox control. I > populate the content of that ListBox at run time. To save on > footprint size, I set EnableViewState=False. > > But by doing that, the SelectedIndexChanged stops working > (AutoPostBack is still = True). Any know of this odd behavior? > > I have a Response.Redirect in my SelectedIndexChanged function, so I > have no need to keep EnableViewState=True. And since any click would > result in a redirect, I have no need to "re"load the ListBox on > page_load if IsPostBack. > > I know this can be solved by turning EnableViewState = True, but that > would also make the rendered HTML & view state blob grow at an > exponential rate when listbox contains hundreds of items... > > Can anyone help? >
Custom Controls & Javascript
DataGrid with edititemtemplate What happened to Alignment property? Another basic question: How to call and show one Web Form from another Web Form? RadioButton in 2 GroupNames? Specifying Width and Height properties as percentages navigate through multipage hiddenfield / htmlInputHidden ? Event Handling Question Problems with ListBox Control |
|||||||||||||||||||||||