This is a migrated thread and some comments may be shown as answers.

RadListBox OnSelectedIndexChanged

5 Answers 334 Views
ListBox
This is a migrated thread and some comments may be shown as answers.
Caleb
Top achievements
Rank 1
Caleb asked on 15 Aug 2012, 09:02 AM
When I have a RadListBox that allows multiple selections, such as:

<telerik:RadListBox ID="rlbItems" runat="server" AutoPostBack="true" Height="200px"
SelectionMode="Multiple" OnSelectedIndexChanged="items_SelectedIndexChanged" />

The server side event only fires when a single selection is made via a click. If the user clicks to drag across several items, then the event never fires. Is there another event I should be using, or another way to make this even fire appropriately when the selected items change?

5 Answers, 1 is accepted

Sort by
0
Nencho
Telerik team
answered on 16 Aug 2012, 12:17 PM
Hello Caleb,

Actually the multiple selection mode is entirely client-side feature and it is not compatible with the
OnSelectedIndexChanged server-side event.
I could suggest you to use the corresponding client-side event - OnClientSelectedIndexChanged. If this implementation does not satisfy your scenario, could you please elaborate a bit more about the desired functionality, that you are trying to achieve?


Regards,
Nencho
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Caleb
Top achievements
Rank 1
answered on 04 Sep 2012, 03:23 AM
Each item in my list has one or more options associated with it, and as they're selected, I'm trying to show a sum of available options in a second list. So if the first list has options a, b and c, and each has detail info associated with it, each time the selection changes I want to update the second list so the user can drill down to more specific selections.

For example, if they select A through B, then they could select A1, A2, and B3 from the second list that gets updated once they first list is changed.

The problem is if their initial selection is a drag, the second list never gets rebound. However, if they first drag, then make the final selection by pressing CTRL and clicking on another item, the list firsts the  on changed as expected and the selected items are available as expected.
0
Nencho
Telerik team
answered on 04 Sep 2012, 03:33 PM
Hi Caleb,

As I mentioned in the previous response, determine the selected items by OnClientSelectedIndexChanged or OnSelectedIndexChanged events is not suitable for your scenario, because they are useful when the SelectionMode is set to "Single".
I could suggest you to use Checkboxes feature of the RadListBox control in order to implement the desired functionality. Thus you could easily determine the client's choice with the help of the server-side event OnItemCheck and populate the second RadListBox based on previous selection. In addition, this is a common and user-friendly way to achieve the desired functionality.
 
Greetings,
Nencho
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Caleb
Top achievements
Rank 1
answered on 04 Sep 2012, 03:57 PM
I actually started out with that, but the problem was you could still select the other way. I tried various ways to prevent selection using javascript, but it was inconsistent across browsers, and leaving the selection ability there confused users. If I could set the selection type to none and just use checks, that would work, but it doesn't seem like disabling selection is a feature either?
0
Nencho
Telerik team
answered on 05 Sep 2012, 11:07 AM
Hi Caleb,

In order to implement the aforementioned scenario, you could cancel the SelectedIndexChanged client-side event.
Please find the attached sample in order to observe the desired functionality.

Regards,
Nencho
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
ListBox
Asked by
Caleb
Top achievements
Rank 1
Answers by
Nencho
Telerik team
Caleb
Top achievements
Rank 1
Share this question
or