I use this code but I dont' work. Please help me.
// Add data into gridview multicolumnbobox
bool isColumnAdded = false;
bool isColumnAdded1 = false;
void radGridViewDetail_CellBeginEdit(object sender, EventArgs e)
{
GridViewEditManager edit = (GridViewEditManager)sender;
GridViewColumn data = edit.GridViewElement.CurrentColumn;
//MessageBox.Show(data.Index.ToString());
if (data.Index == 1)
{
if (this.radGridViewDetail.CurrentColumn is GridViewMultiComboBoxColumn && data.Index == 1)
{
if (isColumnAdded == false)
{
isColumnAdded = true;
RadMultiColumnComboBoxElement editor = (RadMultiColumnComboBoxElement)this.radGridViewDetail.ActiveEditor;
editor.EditorControl.MasterTemplate.AutoGenerateColumns = false;
editor.EditorControl.Columns.Clear();
editor.EditorControl.Columns.Add(new GridViewTextBoxColumn("strProductID"));
editor.EditorControl.Columns.Add(new GridViewTextBoxColumn("memDescription"));
editor.EditorControl.Columns.Add(new GridViewTextBoxColumn("dblUnitsInStock"));
editor.EditorControl.Columns.Add(new GridViewTextBoxColumn("dblUnitsAllocated"));
editor.EditorControl.Columns.Add(new GridViewTextBoxColumn("curSalesPrice"));
editor.EditorControl.Columns.Add(new GridViewTextBoxColumn("strWarehouseID"));
editor.EditorControl.Columns[0].HeaderText = "Item No";
editor.EditorControl.Columns[1].HeaderText = "Description";
editor.EditorControl.Columns[2].HeaderText = "Stock";
editor.EditorControl.Columns[3].HeaderText = "Available";
editor.EditorControl.Columns[4].HeaderText = "Price";
editor.EditorControl.Columns[5].HeaderText = "Warehouse";
editor.AutoSizeDropDownToBestFit = true;
//if (editor.EditorControl.Columns.Count == 8)
//{
// editor.EditorControl.Columns.RemoveAt(7);
// editor.EditorControl.Columns.Remove("strNotes");
//}
}
}
}
if (data.Index == 2)
{
if (this.radGridViewDetail.CurrentColumn is GridViewMultiComboBoxColumn && data.Index == 2)
{
if (isColumnAdded1 == false)
{
isColumnAdded1 = true;
RadMultiColumnComboBoxElement editor = (RadMultiColumnComboBoxElement)this.radGridViewDetail.ActiveEditor;
editor.EditorControl.MasterTemplate.AutoGenerateColumns = false;
editor.EditorControl.Columns.Clear();
editor.EditorControl.Columns.Add(new GridViewTextBoxColumn("strWarehouseID"));
editor.EditorControl.Columns.Add(new GridViewTextBoxColumn("strNotes"));
editor.EditorControl.Columns[0].HeaderText = "Warehouse ID";
editor.EditorControl.Columns[1].HeaderText = "Notes";
editor.AutoSizeDropDownToBestFit = true;
}
}
}
}