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

MultiRowRecord with GridDataBoundGrid and Celltypes: DropDownBox

Hello
I have studied the examples
1. MultiRowRecord with the GridDataBoundGrid
2. Celltypes DropDown in the GridControl

Is ist possible to change the celltypes in the GridDataBound to a DropDownBox? I want a MultiRowRecord with one DropDownbox in one cell.

I have already tried this:

DataTable dt;
private void Form1_Load(object sender, System.EventArgs e)
{
this.gridDataBoundGrid1.Binder.SuspendBinding();

DataColumn column;

column = new DataColumn();
column.DataType = System.Type.GetType("System.String");
dt.Columns.Add(column);

column = new DataColumn();
column.DataType = System.Type.GetType("System.String");
dt.Columns.Add(column);

DataRow dr = dt.NewRow();
dr[1] = "One";
dr[0] = "One";

dt.Rows.Add(dr);


this.gridDataBoundGrid1.DataSource = dt;
this.gridDataBoundGrid1.Binder.ResumeBinding();

StringCollection items = new StringCollection();
items.Add("One");
items.Add("Two");
items.Add("Three");

gridDataBoundGrid1[1, 1].CellType = "ComboBox";
gridDataBoundGrid1[1, 1].ChoiceList = items;

but it does not work.
Thanx for any help!


2 Replies

AD Administrator Syncfusion Team March 20, 2007 04:23 PM UTC

Hi Xerxos,

By default, DataBoundGrid doesn't store any style info properties. You can not set any cell or row specific properties for the DataBoundGrid other than the CellValue. You need to handle the PrepareViewStyleInfo (or Model.QueryCellInfo) Event to do this. Through this event you can set the style properties for the grid.

To set the CellType for a cell, you check for the e.RowIndex/e.ColIndex, if that points to the row you desired, set the e.Style.CellType for it.

////
e.Style.CellType = "ComboBox";
e.Style.ChoiceList = items;

See the KnowledgeBase Articles for more info.
QueryCellInfo event : http://www.syncfusion.com/Support/article.aspx?id=10351
PrepareViewStyleInfo event :http://www.syncfusion.com/Support/article.aspx?id=560

Regards,
Haneef


AD Administrator Syncfusion Team March 21, 2007 09:02 AM UTC

Thank you very much, it works fine now! ;)

Loader.
Live Chat Icon For mobile
Up arrow icon