This is a migrated thread and some comments may be shown as answers.
RadGrid DataSource and Selection not playing nice
2 Answers 12 Views
This is a migrated thread and some comments may be shown as answers.
Kevin
Top achievements
Rank 1
Kevin asked on 07 Aug 2014, 06:24 PM
I have a RadGrid with dynamically populated rows that updates frequently using Rebind, NeedDataSource, and a DataTable.  This functions very well, until I try to select rows in my grid.  The short explanation is that every time the DataSource on the RadGrid changes, selected rows are reset and do not persist.  I've been ripping my hair out trying to get around this, but I've had no success.  Here are some scenarios I've tried.

-Rebind, NeedDataSource, new DataTable - Selected rows do not persist
-Rebind, NeedDataSource, modify an existing DataTable - Selected rows do not persist
-Remove Rebind and NeedDataSource, manually modify an existing DataTable - Grid does not update
-Remove Rebind and NeedDataSource, manually modify an existing DataTable, set DataSource and call DataBind - Selected rows do not persist
-Rebind, NeedDataSource, manually track row selections and set the GridDataItem.Selected property after setting the DataSource - Selected rows do not persist

So the conclusions I've come to is that selected rows are reset whenever the DataSource property is changed, a RadGrid will not update unless the DataSource property is changed, and the GridDataItem.Selected set property does not do what I would expect it to do.

Is there any way to accomplish this, or am I completely out of luck?  Thanks!

2 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 1
answered on 08 Aug 2014, 04:18 AM
Hi Kevin,

This is the expected behavior of RadGrid, it loses its current selection when the grid Rebinds. You can take a look at the following help article to know how to persist the selected rows.
Persisting the Selected Rows Server-side on Sorting/Paging/Filtering/Grouping

Thanks,
Shinu

0
Luis
Top achievements
Rank 1
answered on 05 Jul 2016, 06:50 PM

As is said in the next post it's a expected behavior. Here the suggestion from telerik documentation : 

Persisting the Selected Rows Server-side on Sorting/Paging/Filtering/Grouping

Tags
Grid
Asked by
Kevin
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 1
Luis
Top achievements
Rank 1
Share this question
or