selectedvalues on multiselect

6 posts, 1 answers
  1. Chrys
    Chrys avatar
    45 posts
    Member since:
    Feb 2013

    Posted 24 Apr 2013 Link to this post

    I have a radgrid with a sql datasource hooked to it. I set the datakeynames = the identifier value of the sql datasource. I have multiselect set on the grid but when I select multiple columns the selectedvalues only shows the last one selected. I need all of the keys selected.
  2. Answer
    Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 24 Apr 2013 Link to this post

    Hi,

    Please take a look into this help documentation which describe how to get the DataKeyValue from selected row.

    Thanks,
    Princy.

  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Chrys
    Chrys avatar
    45 posts
    Member since:
    Feb 2013

    Posted 24 Apr 2013 Link to this post

    This is how I ended up doing it thanks.
  5. Charles
    Charles avatar
    4 posts
    Member since:
    Jul 2015

    Posted 28 Jul 2015 Link to this post

    Should I then not use the SelectedValues property at all?   My SelectedItems list is correct and I can certainly loop through it to make my own list of selected key values but it seems this should already be done in the SelectedValues property which only ever seems to return one value?
  6. Charles
    Charles avatar
    4 posts
    Member since:
    Jul 2015

    Posted 28 Jul 2015 in reply to Charles Link to this post

    Nevermind, I understand now.  The SelectedValues is not a field to contain key values from multiple rows that were selected, it is the plural of SelectedValue if one row is selected but multiple key fields are defined.

     

  7. Eyup
    Admin
    Eyup avatar
    3012 posts

    Posted 31 Jul 2015 Link to this post

    Hi Charles,

    Yes, you are correct. You can traverse the SelectedItems collection of the grid to access the details of the selected items:
    http://docs.telerik.com/devtools/aspnet-ajax/controls/grid/functionality/selecting/how-to/retrieving-primary-key-field-values-for-selected-items
    https://admin.telerik.com/docs.telerik.com/devtools/aspnet-ajax/controls/grid/rows/accessing-cells-and-rows#accessing-raw-field-data-and-key-values

    Please note that only the visible records on the current page are loaded at a time, therefore, to get all the items through all pages, you will need to temporarily disable paging. You can examine the sample provided in the last post for an actual implementation:
    http://www.telerik.com/support/code-library/get-selected-items-through-all-pages#1eTU8nr-GUG8zfGgOGbIcA

    Hope this helps.

    Regards,
    Eyup
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017