I already know how to specify the datasource but afther doing that it is not populated yet so i was thinking you need some kind of bind() command to populate the comboboxcolumn in the edit form This below is how i bind the datasource to the comboboxcolumn (and yes i am sure that ds has data rows in it)
(ASPxGridView4.Columns["Naam"] as GridViewDataComboBoxColumn).PropertiesComboBox.DataSource = ds as DataSet;
So could anyone tell me how i can now populate the comboboxcolumn in edit mode?
Edit
protected void ASPxGridView4_InitNewRow(object sender, DevExpress.Web.Data.ASPxDataInitNewRowEventArgs e)
{
if (dt.Rows.Count < 1)
{
ds = Session["ds"] as DataSet;
}
GridViewDataComboBoxColumn column = (ASPxGridView4.Columns["Naam"] as GridViewDataComboBoxColumn);
column.PropertiesComboBox.DataSource = ds.Tables[0];
column.PropertiesComboBox.ValueField = "Naam";
column.PropertiesComboBox.ValueType = typeof(string);
column.PropertiesComboBox.TextField = "Naam";
}
Here is the code which should work:
DataSet dataSet = ds as DataSet;
GridViewDataComboBoxColumn column = (ASPxGridView4.Columns["Naam"] as GridViewDataComboBoxColumn);
column.PropertiesComboBox.DataSource = dataSet.Tables[0];
column.PropertiesComboBox.ValueField = "SomeValueField";
column.PropertiesComboBox.ValueType = typeof(int); // type of the SomeValueField
column.PropertiesComboBox.TextField = "SomeTextField";
Also, please refer to the GridViewDataComboBoxColumn Class topic.
UPDATE Your code should be implemented in the CellEditorInitialize event as shown below:
protected void ASPxGridView1_CellEditorInitialize(object sender, ASPxGridViewEditorEventArgs e) {
if(e.Editor is ASPxComboBox) {
ASPxComboBox combo = ((ASPxComboBox)e.Editor);
combo.DataSource = dataSet.Tables[0];
combo.TextField = "Naam";
combo.ValueField = "Naam";
combo.DataBindItems();
}
}