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

Synchronizing GridViewSelectColumn

1 Answer 85 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Steven
Top achievements
Rank 1
Steven asked on 06 Mar 2014, 10:30 PM
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

1 Answer, 1 is accepted

Sort by
0
Dimitrina
Telerik team
answered on 11 Mar 2014, 04:34 PM
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.

Tags
GridView
Asked by
Steven
Top achievements
Rank 1
Answers by
Dimitrina
Telerik team
Share this question
or