Essential Grouping ASP.NET
Grouping & CheckBox Control
December 5, 2011 02:42 AM by Ragamathulla B[Syncfusion]
Dadasaheb Chobhe
Grouping & CheckBox Control
November 25, 2011 04:23 AM
I am add checkbox to the GrdiGroup Control. I want to change the state of checkbox in grouping. If Group contains 4 record, if i checked 4 records then it should be check group header checkbox and vice versa.

Thank you
Dadasaheb Chobhe

Ragamathulla B
[Syncfusion]
Grouping & CheckBox Control
December 5, 2011 02:42 AM
Hi Dadasaheb,

Thank you for your interest in Syncfusio products.

You can change the checkbox status based on the parent table selection by using ‘TableControlCurrentCellChanging’ event. The following code explains the same.

void gridGroupingControl1_TableControlCurrentCellChanging(object sender, GridTableControlCancelEventArgs e)
{
GridCurrentCell cc = this.gridGroupingControl1.TableControl.CurrentCell;
GridStyleInfo style = cc.Renderer.CurrentStyle;

if (cc.Renderer is GridCheckBoxCellRenderer)
{
CultureInfo culture = style.GetCulture(true);
// Load representations for True / False.
string strTrue = "", strFalse = "";
GridCheckBoxCellInfo ua = style.ReadOnlyCheckBoxOptions;
if (ua != null && ua.CheckedValue != null)
strTrue = ua.CheckedValue;
if (GridUtil.IsEmpty(strTrue))
strTrue = "1";
if (ua != null && ua.UncheckedValue != null)
strFalse = ua.UncheckedValue;
if (GridUtil.IsEmpty(strFalse))
strFalse = "0";
// Switch to next value
string strVal = style.Text;
// Checked to unchecked.
if (strVal.ToLower(culture) == strTrue.ToLower(culture))
strVal = strFalse;
// Unchecked to checked.
else
strVal = strTrue;
// Store value.
this.gridGroupingControl1.TableModel[cc.RowIndex, cc.ColIndex].Text = strVal;
this.gridGroupingControl1.Table.Records[0].NestedTables[0].Records[0].SetValue("Status", strVal);
}
}

Please refer to the following sample which illustrates the same.

http://www.syncfusion.com/downloads/Support/DirectTrac/85957/GGCCheckbox-421602947.zip

Please let me know if you have any further concerns.

Regards,
Ragamathullah B.


::adCenter::