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.

Work with checkbox column in GridGroupingControl

Thread ID:

Created:

Updated:

Platform:

Replies:

127740 Dec 6,2016 03:21 AM Dec 8,2016 08:03 AM Windows Forms 1
loading
Tags: GridGroupingControl
Truong
Asked On December 6, 2016 03:21 AM


------
gridGroupingControl1.TableDescriptor.Columns[i].Appearance.AnyRecordFieldCell.CellType = GridCellTypeName.CheckBox;
------
I have a gridgroupingcontrol which have checkbox column , four column READ,WRITE,UPDATE,DELETE have int value 

How i can click on checkbox, then set the value of this column , example : no check = 0 , checked = 1, i can not checked when click on this checkbox

How to add a checkbox on header column of READ,WRITE,UPDATE,DELETE, when checked on that check box , all of checbox in that column will be checked

Thank for your help !

Piruthiviraj Malaimelraj [Syncfusion]
Replied On December 8, 2016 08:03 AM

Hi Truong, 
 
Thanks for your interest in Syncfusion products. 
 
We have analyzed your scenario and created the simple sample. To use the checkbox in column header and changed the check state dynamically, QueryCellStyleInfo, SaveCellText events can be used and changed the check state for whole column based on column header_ checkbox , TableControlCheckBoxClick event can be used. In order to change the “True” and “False” values as you wanted, CheckBoxOptions property can be used. Please make use of the below code, 
 
Code example: 
object cellValue = "0"; 
this.gridGroupingControl1.QueryCellStyleInfo += new GridTableCellStyleInfoEventHandler(gridGroupingControl1_QueryCellStyleInfo); 
this.gridGroupingControl1.SaveCellText += new Syncfusion.Windows.Forms.Grid.GridCellTextEventHandler(gridGroupingControl1_SaveCellText); 
 
void gridGroupingControl1_SaveCellText(object sender, Syncfusion.Windows.Forms.Grid.GridCellTextEventArgs e) 
{ 
    GridTableCellStyleInfo style = (GridTableCellStyleInfo)e.Style; 
    if (style.Enabled && style.TableCellIdentity.TableCellType == GridTableCellType.ColumnHeaderCell) 
    { 
        cellValue = e.Text; 
        e.Handled = true; 
    } 
} 
 
void gridGroupingControl1_QueryCellStyleInfo(object sender, GridTableCellStyleInfoEventArgs e) 
{ 
    if (e.TableCellIdentity.TableCellType == GridTableCellType.ColumnHeaderCell && e.TableCellIdentity.Column.Name == "Column2") 
    { 
        e.Style.CellType = "CustomCheckBox"; 
        e.Style.CellValue = cellValue; 
     //To set '1' and '0' instead of "True" and "False" 
        e.Style.CheckBoxOptions = new GridCheckBoxCellInfo("1", "0", "", true); 
        e.Style.ReadOnly = false; 
        e.Style.Enabled = true; 
    } 
 
    e.Handled = true; 
} 
 
Sample link: 
 
Please refer to below KB for further references, 
 
Regards, 
Piruthiviraj

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.

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.

;