how to bind dynamically Gridview

Jayakumars
Posted by Jayakumars under ASP.NET AJAX category on | Points: 40 | Views : 1209
hi

I have just button click event both column in same name bind generate datatable and boundfield


protected void Button1_Click(object sender, EventArgs e)
{
dt.Columns.Add("Name");
DataRow dr = dt.NewRow();
dr[0] = "Jesus";
dt.Rows.Add(dr);

BoundField BFiled1 = new BoundField();
BFiled1.HeaderText = "Name";
BFiled1.DataField = "Name";
grd1.Columns.Add(BFiled1);

grd1.DataSource = dt;
grd1.DataBind();
}

Comments or Responses

Login to post response