Selectively adding a checkbox to a cell based on how it is grouped.
Thank you for using Syncfusion products.
By default, we can add the checkbox to the cell by setting the celltype as checkbox. As per your requirement, we had done a simple customization of the GridGroupingControl containing the second column with the checkboxes. Also, specific cell from another column as checkbox (this customization is done using QuerCellStyleInfo Event). Please refer to the following sample, code and image.
Code :
void gridGroupingControl1_QueryCellStyleInfo(object sender, GridTableCellStyleInfoEventArgse)
{
GridTableCellStyleInfoIdentity id = e.TableCellIdentity asGridTableCellStyleInfoIdentity;
Record record;
if (id.DisplayElement.IsRecord())
{
record = id.DisplayElement.GetRecord();
if (e.TableCellIdentity.ColIndex==4 && id.TableCellType ==GridTableCellType.RecordFieldCell && record!=null && record.GetValue("Column3").Equals("row10col3"))
{
e.Style.CellType = "CheckBox";
e.Style.CellValueType = typeof(bool);
e.Style.CellValue = CheckBoxValue;
e.Style.ReadOnly = false;
e.Style.CellAppearance = GridCellAppearance.Raised;
e.Style.Enabled = true;
}
}
e.Handled = true;
}
Sample : http://www.syncfusion.com/downloads/support/forum/120641/ze/CS886333781
To achieve it, only the following assemblies are required. If you have Essential Studio with WindowsForms platform installed, you can get all these from installed location. “C:\Program Files (x86)\Syncfusion\Essential
Studio\<installed Version>\Assemblies\4.0”.
Please let us know if you have any other concerns.
Thanks & Regards,
AL.Solai.
We are glad that your requirement has been achieved.
Please let us know if you need any further assistanece.
Regards,
Anish
- 3 Replies
- 3 Participants
-
DM David McDermid
- Sep 29, 2015 11:58 PM UTC
- Oct 2, 2015 07:54 AM UTC