Completed
Last Updated: 16 Nov 2015 15:56 by ADMIN
ADMIN
Stefan
Created on: 12 Feb 2014 14:47
Category: GridView
Type: Bug Report
0
FIX. RadGridView - the default value for RadDropDownListEditor is not saved when CellEditorInitialized event is used and no selection changes are performed
To reproduce:
-add a RadGridView and use the following code:

public Form1()
{
    InitializeComponent();


    GridViewComboBoxColumn comboColumn = new GridViewComboBoxColumn("ComboBox column");
    comboColumn.DataSource = new List<string>() { "first", "second", "third" };
    radGridView1.Columns.Add(comboColumn);


    radGridView1.CellEditorInitialized += radGridView1_CellEditorInitialized;
}


private void radGridView1_CellEditorInitialized(object sender, GridViewCellEventArgs e)
{
    RadDropDownListEditor dropDownEditor = radGridView1.ActiveEditor as RadDropDownListEditor;
    RadDropDownListEditorElement dropDownEditorElement = dropDownEditor.EditorElement as RadDropDownListEditorElement;


    dropDownEditorElement.SelectedIndex = 0;
}


If you try to add a new row in the grid, the first item in the RadDropDownListEditor is selected. If you do not make any selection changes and press Enter key, the new row will not be added.


Workaround: use the DefaultValuesNeeded event for initializing RadDropDownListEditorElement's selectin
0 comments