Hi,
I have a gridview with one combobox column that its populated depending of the value entered in column 1. The combobox column is populated as expected, but, if I save the values and open the record and click inside the combobox column the selected value in that row its not the value that comes from the db, it always select the first value of the combobox. And I need to get the saved selected value when I enter into edit mode.
My code
private void radGridView1_CellEditorInitialized(object sender, GridViewCellEventArgs e)
{
RadDropDownListEditor listEditor = this.radGridView1.ActiveEditor as RadDropDownListEditor;
if (listEditor == null)
{
return;
}
RadDropDownListEditorElement editorElement = listEditor.EditorElement as RadDropDownListEditorElement;
editorElement.AutoCompleteMode = AutoCompleteMode.SuggestAppend;
editorElement.DropDownStyle = Telerik.WinControls.RadDropDownStyle.DropDownList;
string item = radGridView1.CurrentRow.Cells[0].Value == null ? "" : radGridView1.CurrentRow.Cells[0].Value.ToString();
var result = SqlClass.GetUOMByItem(item);
editorElement.DataSource = null;
editorElement.Items.Clear();
editorElement.DataSource = result;
editorElement.DisplayMember = "UOFM";
editorElement.ValueMember = "UOFM";
if (editorElement.Items.Count > 0)
{
editorElement.SelectedValue = null;
editorElement.SelectedValue = this.radGridView1.CurrentCell.Value;
}
}
thanks for your help!!