I am using RadDropDownListEditor. When the selection is made and dropdown loses focus, the cell reverts from the display text to the value.
How to keep the display text and not replace the cell with the value once the selection is made? I found an old thread back to 2011 which reported the same issue, however the suggestion does not fit my scenario, as I have to use a GridViewTextBoxColumn.
Here is the simplified sample of my cs codes. The designer is very simple, just a GridViewTextBoxColumn in a RadGridView control. A screenshot of the issue is also attached.
Any suggestion is appreciated.
Regards,
Shuping
How to keep the display text and not replace the cell with the value once the selection is made? I found an old thread back to 2011 which reported the same issue, however the suggestion does not fit my scenario, as I have to use a GridViewTextBoxColumn.
Here is the simplified sample of my cs codes. The designer is very simple, just a GridViewTextBoxColumn in a RadGridView control. A screenshot of the issue is also attached.
public partial class Form1 : RadForm{ public Form1() { InitializeComponent(); this.radGridView1.EditorRequired += radGridView1_EditorRequired; this.radGridView1.CellEditorInitialized += radGridView1_CellEditorInitialized; } void radGridView1_CellEditorInitialized(object sender, GridViewCellEventArgs e) { if (e.ActiveEditor is RadDropDownListEditor) { RadDropDownListEditor editor = e.ActiveEditor as RadDropDownListEditor; RadDropDownListEditorElement element = (RadDropDownListEditorElement)editor.EditorElement; element.DisplayMember = "Description"; element.ValueMember = "Code"; element.DataSource = this.CreateDataTable(); element.SelectedIndex = -1; } } void radGridView1_EditorRequired(object sender, EditorRequiredEventArgs e) { e.EditorType = typeof(RadDropDownListEditor); } private DataTable CreateDataTable() { DataTable dataTable = new DataTable(); dataTable.Columns.Add("Code", typeof(decimal)); dataTable.Columns.Add("Description", typeof(string)); for (int i = 0; i < 5; i++) { DataRow dr = dataTable.NewRow(); dr[0] = i + 1; dr[1] = "Description " + (i + 1); dataTable.Rows.Add(dr); } return dataTable; }}Any suggestion is appreciated.
Regards,
Shuping