Unplanned
Last Updated: 14 Aug 2017 11:49 by ADMIN
ADMIN
Dess | Tech Support Engineer, Principal
Created on: 29 Jun 2017 09:27
Category: GridView
Type: Bug Report
1
FIX. RadGridView - check the rows for all pages in a GridViewCheckBoxColumn when the header checkbox is toggled
To reproduce: 
1. Add a RadGridView with a GridViewCheckBoxColumn and enable the paging functionality for it.
2. Toggle the header checkbox on the first page. Only the rows from the page are toggled.

Workaround: you can subscribe to the HeaderCellToggleStateChanged event and toggle all rows:

 private void radGridView1_MouseUp(object sender, MouseEventArgs e)
 {
     if (this.radGridView1.Tag+""=="toggle")
     {
         this.radGridView1.Tag = null;
         this.radGridView1.HeaderCellToggleStateChanged -= radGridView1_HeaderCellToggleStateChanged;
     }
 }

 private void radGridView1_MouseDown(object sender, MouseEventArgs e)
 {
     RadCheckBoxElement element = this.radGridView1.ElementTree.GetElementAtPoint(e.Location) as RadCheckBoxElement;
     if (element != null && element.Parent is GridCheckBoxHeaderCellElement)
     {
         this.radGridView1.Tag = "toggle";
         this.radGridView1.HeaderCellToggleStateChanged += radGridView1_HeaderCellToggleStateChanged;
     }
 }

 private void radGridView1_HeaderCellToggleStateChanged(object sender, GridViewHeaderCellEventArgs e)
 { 
     this.radGridView1.BeginUpdate();
     foreach (GridViewRowInfo row in this.radGridView1.Rows)
     {
         row.Cells["Discontinued"].Value = e.State;
     }
     this.radGridView1.EndUpdate(); 
 }
0 comments