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

Cell control is null right after i instantiate it

Could someone explain me why the cell control is null after the following operations?

grd.TableDescriptor.Columns[SOME_COLUMN_HEADER].Appearance.AnyRecordFieldCell.CellType = "Control";
grd.TableDescriptor.Columns[SOME_COLUMN_HEADER].Appearance.AnyRecordFieldCell.VerticalAlignment = Syncfusion.Windows.Forms.Grid.GridVerticalAlignment.Middle;
grd.TableDescriptor.Columns[SOME_COLUMN_HEADER].Appearance.AnyRecordFieldCell.HorizontalAlignment = Syncfusion.Windows.Forms.Grid.GridHorizontalAlignment.Center;

grdGroupingControl.Rows[rowIndex].Cells[colIndex].Control = new MyCustomControl();

thx


1 Reply

SR SubhaSheela R Syncfusion Team June 25, 2008 12:57 PM UTC

Hi Jack,

Sorry for the long delay in getting back to you.

You need to handle QueryCellStyleInfo event of GridGrouping Control to set the CellType. Below is the code snippet:


private void gridGroupingControl1_QueryCellStyleInfo(object sender, Syncfusion.Windows.Forms.Grid.Grouping.GridTableCellStyleInfoEventArgs e)
{
if (e.TableCellIdentity.RowIndex >= 4 && e.TableCellIdentity.ColIndex == 2)
{
e.Style.CellType = "Control";
e.Style.Control = CB;
System.Collections.Specialized.StringCollection sc = new System.Collections.Specialized.StringCollection();
sc.Add("Australia");
sc.Add("Canada");
sc.Add("London");
sc.Add("Swiz");
e.Style.ChoiceList = sc;
}
}


Here is the sample that illustrates the same:

GGCContrrolCellType.zip

Please let me know if it helps.

Regards,
Subhasheela R









Loader.
Live Chat Icon For mobile
Up arrow icon