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
close icon

Customize each record''s CellType based on data type on other Column

Hello,

I have datatable with columns: "ColumnName","Value" which is binded to a GridGroupingControl.

"ColumnName" type was set to ComboBox.
1. How to customize cell type of column("Value")on each row based on user input on ColumnName?
e.g. DropDownMonthCalendar, ComboBox, CheckBox, TextBox.
2. If it was set to ComboBox, how to add the ChoiceList?

Thanks and Regards,
Harry


1 Reply

AD Administrator Syncfusion Team March 25, 2008 10:01 AM UTC

Hi Harry,

You can customize the CellType using TableControlCurrentCellChanged event. Please refer the code snippet below that shows how you can handle TableControlCurrentCellChanged to change the celltype


private void gridGroupingControl1_TableControlCurrentCellChanged(object sender,

Syncfusion.Windows.Forms.Grid.Grouping.GridTableControlEventArgs e)
{
string s;
GridCurrentCell cc = gridGroupingControl1.TableControl.CurrentCell;
GridCellRendererBase renderer = cc.Renderer;
if (cc.RowIndex > 0 & cc.ColIndex > 0)
{
s = renderer.ControlValue.ToString();
if (s == "ComboBox")
{
StringCollection item1 = new StringCollection();
item1.Add("123456");
item1.Add("qwert");
item1.Add("zxcvb");


this.gridGroupingControl1.TableDescriptor.Columns["Value"].Appearance.AnyRecordFieldCell.Cel

lType = "ComboBox";


this.gridGroupingControl1.TableDescriptor.Columns["Value"].Appearance.AnyRecordFieldCell.Cho

iceList = item1;
}
else if (s == "CheckBox")
{


this.gridGroupingControl1.TableDescriptor.Columns["Value"].Appearance.AnyRecordFieldCell.Cel

lType = "CheckBox";
}
else if (s == "TextBox")
{


this.gridGroupingControl1.TableDescriptor.Columns["Value"].Appearance.AnyRecordFieldCell.Cel

lType = "TextBox";
}

}

}


Please refer the sample in the below link that illustrates the above.

http://websamples.syncfusion.com/samples/Grid.Windows/F72465A/main.htm

Please let me know if you have any questions.

Regards,
Asem.


Loader.
Live Chat Icon For mobile
Up arrow icon