I am using the WebDataGrid with the Paging and Selection behaviours.
How can I select all rows by pressing a button? Currently I've tried something like the following:
// Disable paging so that all rows are accessible from the Rows collection
bool paged = Behaviors.Paging != null && Behaviors.Paging.Enabled; if (paged) { Behaviors.Paging.Enabled = false; } // Select all the rows foreach (GridRecord row in Rows) { if (!selection.SelectedRows.Contains(row)) { selection.SelectedRows.Add(row); } } // If the grid was previously paged, re-enable the paging if (paged) { Behaviors.Paging.Enabled = true; }
But this doesn't work. Can anyone please offer any assistance?
Actual, this does work, but for some reason the SelectedRows count is 0 when the ITemplates are initialised.
Hello Will,
there is a new feautre in 10.3 - Persistent Selection. Try to set EnableCrossPageSelection="true" :
<ig:Selection CellClickAction="Row" RowSelectType="Multiple" EnableCrossPageSelection="true"> </ig:Selection>
Then SelectedRows count shouldn't be 0.
Hope this helps