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

selectedvalues on multiselect

5 Answers 47 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Chrys
Top achievements
Rank 1
Chrys asked on 24 Apr 2013, 04:07 PM
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.

5 Answers, 1 is accepted

Sort by
0
Accepted
Princy
Top achievements
Rank 1
answered on 25 Apr 2013, 03:40 AM
Hi,

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

Thanks,
Princy.

0
Chrys
Top achievements
Rank 1
answered on 25 Apr 2013, 03:53 AM
This is how I ended up doing it thanks.
0
Charles
Top achievements
Rank 1
answered on 28 Jul 2015, 04:06 PM
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?
0
Charles
Top achievements
Rank 1
answered on 28 Jul 2015, 05:25 PM

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.

 

0
Eyup
Telerik team
answered on 31 Jul 2015, 08:19 AM
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
Tags
Grid
Asked by
Chrys
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 1
Chrys
Top achievements
Rank 1
Charles
Top achievements
Rank 1
Eyup
Telerik team
Share this question
or