The documentation states:
> If you want to set initial values, you should match the GridViewComboBoxColumn to a column which has appropriate values in it. To do this, you should set the FieldName of the GridViewComboBoxColumn to be the same as the name of the existing column.
Can I see a code sample of how this is done?
I have a text column that I am able to successfully bind to show the values, but I'm not able to replace that text column with a ComboBoxColumn and still have it set the initial values like the text column does. Here's a code sample of what I've tried:
Thanks,
--Jason
> If you want to set initial values, you should match the GridViewComboBoxColumn to a column which has appropriate values in it. To do this, you should set the FieldName of the GridViewComboBoxColumn to be the same as the name of the existing column.
Can I see a code sample of how this is done?
I have a text column that I am able to successfully bind to show the values, but I'm not able to replace that text column with a ComboBoxColumn and still have it set the initial values like the text column does. Here's a code sample of what I've tried:
uxgrdBindingsGrid.MasterTemplate.Columns.Clear();
uxgrdBindingsGrid.AutoGenerateColumns =
false
;
uxgrdBindingsGrid.DataSource = bindings.ToList<SymbolBinding>();
// this textbox column displays fine
GridViewTextBoxColumn dataSourceTextColumn =
new
GridViewTextBoxColumn();
dataSourceTextColumn.Name =
"dataSourceTextColumn"
;
dataSourceTextColumn.HeaderText =
"Data Source"
;
dataSourceTextColumn.FieldName =
"DataSourceProperty"
;
dataSourceTextColumn.TextAlignment = ContentAlignment.MiddleLeft;
dataSourceTextColumn.Width = 150;
dataSourceTextColumn.IsVisible =
true
;
uxgrdBindingsGrid.MasterTemplate.Columns.Add(dataSourceTextColumn);
// this combobox column displays the drop down list if double-clicked, but does not display any values initially
GridViewComboBoxColumn dataSourceComboColumn =
new
GridViewComboBoxColumn(
"DataSourceProperty"
);
dataSourceComboColumn.Name =
"dataSourceComboColumn"
;
dataSourceComboColumn.HeaderText =
"Data Source"
;
dataSourceComboColumn.DataSource =
this
.dataSources;
dataSourceComboColumn.DropDownStyle = RadDropDownStyle.DropDownList;
dataSourceComboColumn.ValueMember =
"ID"
;
dataSourceComboColumn.DisplayMember =
"Path"
;
dataSourceComboColumn.FieldName =
"DataSourceProperty"
;
dataSourceComboColumn.TextAlignment = ContentAlignment.MiddleLeft;
dataSourceComboColumn.Width = 150;
uxgrdBindingsGrid.MasterTemplate.Columns.Add(dataSourceComboColumn);
Thanks,
--Jason