Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > ListBox not firing SelectedIndexChanged (AutoPostBack=True)

Reply
Thread Tools

ListBox not firing SelectedIndexChanged (AutoPostBack=True)

 
 
danob7
Guest
Posts: n/a
 
      06-14-2005
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?
 
Reply With Quote
 
 
 
 
Brock Allen
Guest
Posts: n/a
 
      06-14-2005
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



> 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?
>




 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Composite Control ListBox SelectedIndexChanged event not firing studen771 ASP .Net Web Controls 0 03-27-2007 11:13 PM
Listbox SelectedIndexChanged not firing (Autopostback = True) Edward ASP .Net 1 02-04-2004 03:07 PM
dropdownlist selectedindexchanged event not firing.. please help. DesignerX ASP .Net 2 11-14-2003 03:25 PM
Re: SelectedIndexChanged event not firing Severin ASP .Net 0 08-04-2003 07:39 PM
Re: SelectedIndexChanged event not firing Kevin Spencer ASP .Net 7 08-02-2003 03:14 PM



Advertisments