Hi guys,
I need to retrieve the selected value of a GridViewDataComboBoxColumn in RowInserting handler, with a grid view set to Inline editing mode.
Here the code I use to initialize my cell editor and handling the RowInserting event :
protected void Products_GridView_CellEditorInitialize(Object sender, ASPxGridViewEditorEventArgs e)
{
ASPxGridView grid = (ASPxGridView)sender;
ASPxTextBox textBox = null;
ASPxComboBox comboBox = null;
ASPxSpinEdit spinEdit = null;
if (e.Column.FieldName == "ProductName")
{
comboBox = e.Editor as ASPxComboBox;
comboBox.ID = "ProductName_ComboBox";
comboBox.DropDownStyle = DropDownStyle.DropDown;
comboBox.ValueField = "Guid";
comboBox.TextField = "ProductName";
comboBox.DataSource = ProductsList;
comboBox.DataBind();
}
}
protected void Products_GridView_RowInserting(Object sender, ASPxDataInsertingEventArgs e)
{
ASPxGridView grid = sender as ASPxGridView;
GridViewDataComboBoxColumn column = (GridViewDataComboBoxColumn)grid.Columns["ProductName"];
// Column is not null, great !
ASPxComboBox comboBox = (ASPxComboBox)grid.FindEditRowCellTemplateControl(column, "ProductName_ComboBox");
// comboBox is ALWAYS NULL !!!???
e.Cancel = true;
grid.CancelEdit();
}
Is there something wrong here ? Why is the FindEditRowCellTemplateControl method returning null ?
Thanks by advance,
Eric Morand.