GridAutoCompleteColumn columns cannot be created programmatically during OnLoad event, but only using the OnInit event. In the attached sample, if you comment out panelOnInit.Controls.Add(gridOnInit); and uncomment panelOnLoad.Controls.Add(gridOnLoad); when you click Edit in one row the following exception is thrown Cannot create column with the specified type name: GridAutoCompleteColumn But if you comment out panelOnLoad.Controls.Add(gridOnLoad); and uncomment panelOnInit.Controls.Add(gridOnInit); the sample works Note that if you change the GridAutoCompleteColumn for any other control type, for example GridHTMLEditorColumn, both methods will work.
Hi Igor,
After reviewing the behavior, we confirm that the GridAutoCompleteColumn can indeed be created programmatically during the OnLoad event if it is initialized and configured before being added to the control hierarchy.
protected override void OnLoad(EventArgs e)
{
gridOnLoad = new RadGrid();
gridOnLoad.AutoGenerateColumns = false;
gridOnLoad.NeedDataSource += new GridNeedDataSourceEventHandler(grid_NeedDataSource);
GridAutoCompleteColumn boundColumn = new GridAutoCompleteColumn();
gridOnLoad.MasterTableView.Columns.Add(boundColumn);
boundColumn.DataField = "Item";
boundColumn.HeaderText = "Item";
gridOnLoad.MasterTableView.Columns.Add(new GridEditCommandColumn());
panelOnLoad.Controls.Add(gridOnLoad);
}
OnInit
event to ensure consistent initialization. For reference, you can consult the Creating RadGrid Programmatically article.Since the reported behavior functions as expected, this case will be marked as Completed. If you need further assistance, please feel free to open a new support ticket.
Thank you for your understanding.
Regards,
Rumen
Progress Telerik