G
Guest
Hi,
I have defined a gridview with header columns where 2 columns are normal
columns(boundFields) and other 2 columns as TemplateFields and I would like
to populate this grid with some data dynamically.
So, I used this code and it did add a row but with empty data in first 2
rows(boundFields).
DataTable dt = new DataTable();
dt = (DataTable)rolesGridView.DataSource;
dt.Columns.Add(new DataColumn("ID", typeof(string)));
dt.Columns.Add(new DataColumn("Role", typeof(string)));
DataRow dr = dt.NewRow();
dr["ID"]= "1";
dr["Role"] = "MyRole";
dt.Rows.Add(dr);
And it worked fine with a grid that I just dragged and dropped in form where
I didn't define any specifications in it.
Thanks
I have defined a gridview with header columns where 2 columns are normal
columns(boundFields) and other 2 columns as TemplateFields and I would like
to populate this grid with some data dynamically.
So, I used this code and it did add a row but with empty data in first 2
rows(boundFields).
DataTable dt = new DataTable();
dt = (DataTable)rolesGridView.DataSource;
dt.Columns.Add(new DataColumn("ID", typeof(string)));
dt.Columns.Add(new DataColumn("Role", typeof(string)));
DataRow dr = dt.NewRow();
dr["ID"]= "1";
dr["Role"] = "MyRole";
dt.Rows.Add(dr);
And it worked fine with a grid that I just dragged and dropped in form where
I didn't define any specifications in it.
Thanks