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. Image for the cookie policy date

Selectively adding a checkbox to a cell based on how it is grouped.

Is there a way to do this? I found some examples using the QueryCellStyleInfo event but this require the Web assemblies and they don't appear to be installed on my machine. 

3 Replies

SA Solai A L Syncfusion Team September 30, 2015 12:46 PM UTC

Hi David,

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.



DM David McDermid September 30, 2015 06:00 PM UTC

Thanks, works now. I was missing an imports and when I searched the help file it only pointed me to the web extension. 


AG Anish George Syncfusion Team October 2, 2015 07:54 AM UTC

Hi David,
 
We are glad that your requirement has been achieved.
 
Please let us know if you need any further assistanece.
 
Regards,
Anish

Loader.
Live Chat Icon For mobile
Up arrow icon