I am working on one live project where I use Asp.net as front end and SQL as back end. I want to add new column in datagrid at runtime? Is this possible or not? Any help would be appreciated. Thanks in advanced.
I am working on one live project where I use Asp.net as front end and SQL as back end. I want to add new column in datagrid at runtime? Is this possible or not? Any help would be appreciated. Thanks in advanced.
Use the following language rules to add Column at runtime
DataGridView1.line.Add ( string ColumnName, string ColumnHead)
If your Combobox values are unique then use ComboBox selected value as Column name and Caption if not select your own column name and ColumnHead can be combobox value. Because Column name are unique.
Use SelectedIndexChanged event of Combobox to add new Column and
after adding new Column take away it from the Combobox
Code:DataGridView1.Columns.Add( "MyColumn", "Column 1" );
Bookmarks