Assume you have a grid view radGridView1 and you have a combobox column in it. The column's header text is "Status".
You could use the following code to populate its data source at runtime.
void radGridView1_CellEditorInitialized(object sender, GridViewCellEventArgs e)
{
if (e.Column.HeaderText == "Status")
{
RadComboBoxEditor editor = this.radGridView1.ActiveEditor as RadComboBoxEditor;
RadComboBoxEditorElement element = editor.EditorElement as RadComboBoxEditorElement;
element.DataSource = new string[] { "UP", "DOWN" };
element.SelectedValue = null;
element.SelectedValue = this.radGridView1.CurrentCell.Value;
}
}
No comments:
Post a Comment