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.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

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

Thread ID:

Created:

Updated:

Platform:

Replies:

72465 Mar 20,2008 08:48 AM UTC Mar 25,2008 10:01 AM UTC Windows Forms 1
loading
Tags: GridControl
Harry
Asked On March 20, 2008 08:48 AM UTC

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


Administrator [Syncfusion]
Replied On 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.


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;