Saturday, June 7, 2014

Selectively select all rows in a DevExpress ASPxGridView (and not just all rows in the current page of pagination) with a custom callback.

Do something like this (only less corny).

private void MyGrid_CustomCallback(object sender,
      ASPxGridViewCustomCallbackEventArgs e)
{
   string isChecked = e.Parameters;
   if (isChecked == "true")
   {
      int counter = 0;
      while (counter < MyGrid.VisibleRowCount)
      {
         if (counter == 13 || counter == 42)
         {
            MyGrid.Selection.SelectRow(counter);
         }
         counter++;
      }
   } else {
      MyGrid.Selection.UnselectAll();
   }
}

 
 

Lead in like so:

<ClientSideEvents CheckedChanged="function(s,e)
      {MyGrid.PerformCallback(s.GetChecked());}">
</ClientSideEvents>

No comments:

Post a Comment