RadGrid DataSource and Selection not playing nice

3 posts, 0 answers
  1. Kevin
    Kevin avatar
    2 posts
    Member since:
    Jul 2014

    Posted 07 Aug 2014 Link to this post

    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. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 07 Aug 2014 in reply to Kevin Link to this post

    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

  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Luis
    Luis avatar
    4 posts
    Member since:
    May 2015

    Posted 05 Jul in reply to Kevin Link to this post

    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

Back to Top