RadListBox OnSelectedIndexChanged

6 posts, 0 answers
  1. Caleb
    Caleb avatar
    7 posts
    Member since:
    Jan 2012

    Posted 15 Aug 2012 Link to this post

    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?
  2. Nencho
    Admin
    Nencho avatar
    1457 posts

    Posted 16 Aug 2012 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Caleb
    Caleb avatar
    7 posts
    Member since:
    Jan 2012

    Posted 03 Sep 2012 Link to this post

    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.
  5. Nencho
    Admin
    Nencho avatar
    1457 posts

    Posted 04 Sep 2012 Link to this post

    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.
  6. Caleb
    Caleb avatar
    7 posts
    Member since:
    Jan 2012

    Posted 04 Sep 2012 Link to this post

    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?
  7. Nencho
    Admin
    Nencho avatar
    1457 posts

    Posted 05 Sep 2012 Link to this post

    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.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017