First You should take 2 textboxes and one button.. then write the following code Globally.... static DataSet ds = new DataSet(); static DataTable dt=new DataTable(); and in pageload event you should paste this code if(!IsPostBack) { dt.Columns.Clear(); ds.Clear(); dt.Rows.Clear(); dt.Columns.Add("Name"); dt.Columns.Add("Number"); ds.Tables.Clear(); ds.Tables.Add(dt); DataGrid1.DataSource =ds; DataGrid1.DataBind(); } and Write code for button1.. DataRow r=dt.NewRow(); r[0]=TextBox1.Text; r[1]=TextBox2.Text; ds.Tables[0].Rows.Add(r);// dt.Rows.Add(r); DataGrid1.DataSource =ds; DataGrid1.DataBind();
venki