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

grid cell controls

Hi,

is there a way in a GridDataBoundGrid to have different cells of the same column have a different control, i.e. one free text box and another a combo box?

1 Reply

AD Administrator Syncfusion Team October 26, 2006 05:56 AM UTC

Hi Charbel,

The attached sample shows you how to put different controls into same column in a grid. You will learn how to put pushbutton’s, comboboxes and textboxes into cells. You can handle the Model_QueryCellInfo event of the grid model and set the e.Style.CellType to some new control to want to display. Below is a code snippet.

private void Model_QueryCellInfo(object sender, GridQueryCellInfoEventArgs e)
{
if( e.ColIndex == 3 && e.RowIndex > 0 )
{
switch(e.RowIndex % 3)
{
case 0://ComboBox
e.Style.CellType = "ComboBox";
e.Style.BackColor = Color.AliceBlue;
e.Style.DataSource = GetChildTable();
e.Style.ValueMember = "Name";
break;
case 1://Button CellType
e.Style.CellType = "PushButton";
e.Style.Description = e.Style.Text;
e.Style.Themed = true;
break;
default://TextBox
e.Style.BackColor = Color.Red;
break;
}
}
}

Here is Sample.
http://www.syncfusion.com/Support/user/uploads/GDBGCellType_fa36d1bb.zip

Best Regards,
Haneef

Loader.
Live Chat Icon For mobile
Up arrow icon