How to add columns dynamically on a GridView?
Filed in Uncategorized on May.08, 2007
Here is the way to add a template column to GridView dynamically (runtime):
TemplateField tf = new TemplateField();
tf.HeaderText = "NewTemplate column";
MyTemplate template = new MyTemplate("test");
tf.ItemTemplate = template;
GridView1.Columns.Clear();
GridView1.Columns.Add(tf);
string[] s = { “as”, “34″, “z”, “@#4″, “666″ };
GridView1.DataSource = s;
GridView1.DataBind();
Related posts:






















