我已经在RadGridView
中填充了数据库中的组合框,我希望当它处于添加模式时,我的组合框会将其第一项显示为默认值。我使用了以下代码,但我在代码
private void radGridView_CellValueChanged(object sender, Telerik.WinControls.UI.GridViewCellEventArgs e)
{
if (e.Column.Name == "Productcolumn")
{
//ERROR on debuging following line
RadDropDownListEditor ed = this.radGridView.Columns["UnitPrice"] as RadDropDownListEditor;
if (ed != null)
{
// the default selected Price that will be shown will be the first price, if no price is selected for the current cell
RadDropDownListEditorElement editorElement = (RadDropDownListEditorElement)ed.EditorElement;
editorElement.SelectedIndex = 0;
}
}
}