We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

GGC Checkbox header in grouped row.

Thread ID:

Created:

Updated:

Platform:

Replies:

45105 Jun 12,2006 09:52 AM UTC Jun 13,2006 10:20 AM UTC Windows Forms 2
loading
Tags: GridControl
Kai
Asked On June 12, 2006 09:52 AM UTC

Hi, I would like to add a checkbox in the grouped header of a GGC grid. So when a user click on the checkbox, it will check/uncheck all the checkboxes in a column of that particular group. How can I do that? Many thanks.

Administrator [Syncfusion]
Replied On June 12, 2006 12:37 PM UTC

Hi Kai, To add a checkbox in the grouped rowheader of a grouping grid, you need to change the celltype of the GroupCaptionRowHeaderCell to CheckBox and , handle the TableControlMouseDown event /QueryCellStyleInfo event to achieve the required behaviour. Please find the attachment for more details. Hashtable hash = new Hashtable(); private void gridGroupingControl1_TableControlMouseDown(object sender, Syncfusion.Windows.Forms.Grid.Grouping.GridTableControlMouseEventArgs e) { Point point = new Point(e.Inner.X,e.Inner.Y); Element element = e.TableControl.PointToNestedDisplayElement(point); GridTableCellStyleInfo style = e.TableControl.PointToTableCellStyle(point); bool isvalue = false; if(element.Kind == DisplayElementKind.Caption && style.TableCellIdentity.ColIndex == 0) { object obj = hash[element.ParentGroup.Category ]; if(obj != null && obj.ToString() != "" ) { bool b = (bool)style.CellValue; isvalue = !b; hash[element.ParentGroup.Category ] = !b; } else { hash[element.ParentGroup.Category ] = false; isvalue = false; } foreach( Record r in element.ParentGroup.Records ) { r.SetValue("show",isvalue); } } } private void gridGroupingControl1_QueryCellStyleInfo(object sender, GridTableCellStyleInfoEventArgs e) { GridCurrentCell cc = this.gridGroupingControl1.TableControl.CurrentCell; if(e.TableCellIdentity.DisplayElement.Kind == DisplayElementKind.Caption && e.TableCellIdentity.ColIndex == 0 && e.TableCellIdentity.RowIndex > 2) { object obj =hash[e.TableCellIdentity.DisplayElement.ParentGroup.Category ]; if(obj != null && obj.ToString() != "") { bool b = (bool)obj; e.Style.CellValue = b; } } } Here is a sample. http://www.syncfusion.com/Support/user/uploads/CaptionCheckbox_9458c88.zip Let me know if this helps. Best Regards, Haneef

Kai
Replied On June 13, 2006 10:20 AM UTC

It does indeed work! Many thanks. >Hi Kai, > >To add a checkbox in the grouped rowheader of a grouping grid, you need to change the celltype of the GroupCaptionRowHeaderCell to CheckBox and , handle the TableControlMouseDown event /QueryCellStyleInfo event to achieve the required behaviour. Please find the attachment for more details. > >Hashtable hash = new Hashtable(); >private void gridGroupingControl1_TableControlMouseDown(object sender, Syncfusion.Windows.Forms.Grid.Grouping.GridTableControlMouseEventArgs e) >{ > Point point = new Point(e.Inner.X,e.Inner.Y); > Element element = e.TableControl.PointToNestedDisplayElement(point); > GridTableCellStyleInfo style = e.TableControl.PointToTableCellStyle(point); > bool isvalue = false; > > if(element.Kind == DisplayElementKind.Caption && style.TableCellIdentity.ColIndex == 0) > { > object obj = hash[element.ParentGroup.Category ]; > if(obj != null && obj.ToString() != "" ) > { > bool b = (bool)style.CellValue; > isvalue = !b; > hash[element.ParentGroup.Category ] = !b; > > } > else > { > hash[element.ParentGroup.Category ] = false; > isvalue = false; > } > foreach( Record r in element.ParentGroup.Records ) > { > r.SetValue("show",isvalue); > } > > } >} > > >private void gridGroupingControl1_QueryCellStyleInfo(object sender, GridTableCellStyleInfoEventArgs e) >{ > GridCurrentCell cc = this.gridGroupingControl1.TableControl.CurrentCell; > if(e.TableCellIdentity.DisplayElement.Kind == DisplayElementKind.Caption && e.TableCellIdentity.ColIndex == 0 && e.TableCellIdentity.RowIndex > 2) > { > object obj =hash[e.TableCellIdentity.DisplayElement.ParentGroup.Category ]; > if(obj != null && obj.ToString() != "") > { > bool b = (bool)obj; > e.Style.CellValue = b; > } > } >} > >Here is a sample. >http://www.syncfusion.com/Support/user/uploads/CaptionCheckbox_9458c88.zip > >Let me know if this helps. >Best Regards, >Haneef

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;