I need to generate a datagrid at run time from C# code.
My intention is generate datagrid from C# code and bind data to that grid at run time.
Guys can you help me to achieve this?
I need to generate a datagrid at run time from C# code.
My intention is generate datagrid from C# code and bind data to that grid at run time.
Guys can you help me to achieve this?
try this..
DataGridView dgv = new DataGridView();
/// if your want to fill DataGridView from Database then pass your required datasource to DataGridView, like below..
// dgv.DataSource = dt(Some data Source);
// if you want to add column in Code, then follow below Code..
dgv.Columns.Add("Column", "Name");
dgv.Columns.Add("Column", "Address");
dgv.Rows.Add("abc","xyz");
this.Controls.Add(dgv);