Add boundfield column in gridview at runtime
First of all you have to set the gridview with two bounded column like (name,age)
now if u want to add new column bounded column dob at the run time then follow this code..
protected void Button1_Click(object sender, EventArgs e)
{
BoundField boundField = new BoundField();
boundField.DataField = "DOB";
boundField.HeaderText = "DOB";
boundField.HtmlEncode = false;
boundField.DataFormatString = "{0:d}";
GridView1.Columns.Add(boundField);
//bind gridview..
bindgridview();
}
note: data source must contain the dob column...(i.e. dataset,datatable, datareader and so on)
