I am using a MultiComboBox column in a grid to display attribute types. This is the code to add the column:
GridViewMultiComboBoxColumn col = new GridViewMultiComboBoxColumn("");
col.DataSource = maintenance.AttributesTypesSelectAll();
col.DisplayMember = "attributetype";
col.ValueMember = "attributetypeid";
col.FieldName = "attributetypeid";
col.HeaderText = "Type";
this.grdAttributes.Columns.Add(col);This is the code to show the correct editor when the column is selected:
private void grdAttributes_CellBeginEdit(object sender, GridViewCellCancelEventArgs e)
{
if (this.grdAttributes.CurrentColumn is GridViewMultiComboBoxColumn)
{
if (!this._isColumnAdded)
{
this._isColumnAdded = true;
RadMultiColumnComboBoxElement editor = (RadMultiColumnComboBoxElement)this.grdAttributes.ActiveEditor;
editor.EditorControl.MasterTemplate.AutoGenerateColumns = false;
editor.EditorControl.Columns.Add(new GridViewTextBoxColumn("attributetype"));
editor.EditorControl.Columns["attributetype"].HeaderText = string.Empty;
editor.AutoSizeDropDownToBestFit = true;
}
}
}This works correctly and maps the column to the right value when the column is loaded, but when I edit the column or add a new column it doesn't retain the value. I feel like I'm missing a step but just not sure what at this point. What is the correct way to use a MultiComboBox in a RadGrid to show the text assoicated with an ID field rather than the ID, and then retain that value on add/edits.
