Synchronizing GridViewSelectColumn

2 posts, 0 answers
  1. Steven
    Steven avatar
    18 posts
    Member since:
    Sep 2012

    Posted 06 Mar 2014 Link to this post

    We have a control where a user can select multiple rows in a RadGridView and we store the selected items. No problem. However, if the user later returns to the control and pops up the grid to select more items, the previous selections are not automatically selected already despite the synchronization code (from another post here - keeps the SelectedItems and another collection synchronized).

    So how does one programmatically toggle the IsSelcted for the rows based on the SelectedItems property? When the grid is loaded, the SelectedItems is synchronized with the collection of objects already synchronized, but the GridViewSelectColumn does not display the checkbox as selected so it looks like nothing is selected even though the collection is populated with objects.

    I read one post which suggested using a style trigger but that only works if the rows are visible. These grids can have hundreds or thousands of records.

    Steve
  2. Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 11 Mar 2014 Link to this post

    Hello Steve,

    The items in the SelectedItems collection should be synchronized with the Items being selected in RadGridView. Consequently the GridViewSelectColumn should show those items as checked.

    If you modify the SelectedItems collection from your ViewModel in code, then this will be affected in RadGridView i.e. once you add or remove an item from the SelectedItems collection this should properly affect the UI. The added item will become Selected and the removed item will become unselected.

    May I ask you to share some more details on your exact case? You say the SelectedItems is synchronized with the collection of objects. Are the items in RadGridView properly selected except from the fact that the GridViewSelectColumn does not mark those rows with a check mark?

    Regards,
    Didie
    Telerik

    DevCraft Q1'14 is here! Watch the online conference to see how this release solves your top-5 .NET challenges. Watch on demand now.

Back to Top