Showing posts with label selections. Show all posts
Showing posts with label selections. Show all posts

Monday, March 26, 2012

ListBox not raising event or makes full postBack

I have a ListBox that needs to be updated depending on selections made on another ListBox. The problem I have is that theSelectedIndexChanged event is not raised. If I put AutoPostback="True" (which worked in my little test app that I created first), it performs a full PostBack.

Has anybody experienced something like this? Any ideas a more than welcome.

Hi,

Have you add the eventhandler to your listbox?
<asp:ListBoxID="ListBox1"runat="server"OnSelectedIndexChanged="ListBox1_SelectedIndexChanged">


Sure I did. And have something in the handler just to make sure the second ListBox is updated.


Does a single update panel contains both the listbox. If the parent listbox is outside the update panel then create a AsyncPostbackTrigger and assign that listbox as control.


Of course I added Triggers. These are basic things I need to do to get the AJAX part working.

Still can't figure out what is wrong.

Listbox selections to update secondary listbox items

Good Afternoon,

I am extremely new to the Atlas functionality, and am trying to address some customer requests using Atlas. Two listboxes, Category and SubCategory, are initially rendered on the page with all distinct values. My question is how to update the SubCategory listbox when items have been selected in the Category listbox. I have tried to include a parameter for the selection of the SubCategory items, but the list initially is rendered with no items since the parameter value is not assigned.

Any help, insight, or suggestions is greatly appreciated. Also, any suggestions on best practices is also welcome regarding controls utilizing Atlas (for example, using a dataset to populate the listbox versus going directly against the SQL tables).

Thank you,

Erik

Hi,

It sounds like the CascadingDropDown control in this toolkit may be the answer to your questions.

http://atlas.asp.net/atlastoolkit/CascadingDropDown/CascadingDropDown.aspx

Regards


Thank you for the response. Is there any way to utilize a listbox instead of a drop down? Currently, the users can select multiple items from the list.

Hi,

Could you initially populate the subcategory box in the page_load event (when not Page.Ispostback), then have the list updated with a control event parameter on the Category Listbox.

Hope this helps