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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to load unbound checkbox column in a GridGroupingControl?

Platform: WinForms |
Control: GridGroupingControl |
Published Date: April 30, 2011 |
Last Revised Date: July 14, 2016

You can add the unbound CheckBox columns to the GridGroupingControl by using the TableDescriptor.UnboundFields.Add() method. This method allows you to add the unbound fields to the GridGroupingControl. Unbound values can be provided in QueryValue event and any changes in the values can be stored back to the data store by handling the SaveValue event. Additionally, you can handle QueryCellStyleInfo event to customize unbound cells individually.

You can save the values elsewhere as the grouping grid does not maintain any data structure to store cell values. Since the values are unbound, they cannot be stored into bound data source too. In this example, a HashTable is used to save the values of unbound column. The example displays an unbound CheckBox column along with other bound columns. Refer to the following steps to have an unbound checkbox column in the GridGroupingControl.

1. Adding an unbound column

C#

VB

2. Creating Hashtable to store unbound column values.

C#

VB

3. Declaration of the events

Then QueryValue event is used to edit the values in the checkbox. The SaveValue event is used to save the changes that you made in the checkbox.

C#

VB

The following screenshot illustrates the output.

Figure 1: Adding unbound CheckBox column in GridGroupingControl

Samples

UnboundCheckBoxColumn-C#

UnboundCheckBoxColumn-VB

2X faster development

The ultimate WinForms UI toolkit to boost your development speed.
ADD COMMENT
You must log in to leave a comment
Comments
Joakim
Jul 13, 2016
This code is broken. this.gridGroupingControl1.TableDescriptor.UnboundFields.Add("print"); this.gridGroupingControl1.TableDescriptor.Columns["print"].Appearance.AnyRecordFieldCell.CellType ="CheckBox"; Throws a null refrence exception because there is no column named "print". In other words: TableDescriptor.UnboundFields.Add does not add it to TableDescriptor.Columns. Reply
Mahendran Annamalai [Syncfusion]
Jul 14, 2016
Hi Joakim, Sorry for the inconvenience caused. The broken link has been fixed now. Please check it and let me know your concerns. Regards, Mahendran.A
Bratislav Isailovic
Aug 14, 2016

Code won't work for child tables either! I used:

ggC.GetTableDescriptor["Relation"].UnboundFields.Add("print")

next statement fails:

ggC.GetTableDescriptor["Relation"].Columns["print"].Appearance.AnyRecordFieldCell.CellType = "CheckBox";

Object reference not set to an instance of an object.


Reply
Amal Raj Umapathy Selvam [Syncfusion]
Aug 22, 2016

Hi Bratislav,

 

Thanks for using Syncfusion products.

 

Please create a new incident regarding this query for better follow up.

 

You can create the DT incident from the following link.

http://www.syncfusion.com/account/dashboard

 

Regards,

Amal Raj U.

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

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