Regarding Adding column in a GridView
How can i add a new column to Gridview which is not present in Database?
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Prabhu RajaPosted Sep 14, 2011, 1:37 AM
DataTable dt = new DataTable("TableName");
DataColumn dc;
for (int i = 0; i < 10; i++)
{
dc = new DataColumn(i.ToString());
}
dt.Columns.Add(dc);
MyGridView1.DataSource = dt;
MyGridView1.DataBind();
------------------------------------
If this helps you, then mark as "Correct Answer"