protected void Buttonadd_Click(object sender, EventArgs e) { if (Session["Data"] == null) { C = 1; dt = new DataTable(); DataRow dr = dt.NewRow(); dt.Columns.Add(new System.Data.DataColumn("EMPNAME", typeof(String))); dt.Columns.Add(new System.Data.DataColumn("EMPID", typeof(String))); dt.Columns.Add(new System.Data.DataColumn("DEPARTMENT", typeof(String))); dr[0] = Txtaddname.Text; dr[1] = Txtaddempid.Text; dr[2] = Drpadddept.SelectedItem.Text; dt.Rows.Add(dr); GridView1.DataSource = dt; GridView1.DataBind(); Session["Data"] = dt; } else { C = C + 1; dt = new DataTable(); dt = (DataTable)Session["Data"]; DataRow dr = dt.NewRow(); dr[0] = Txtaddname.Text; dr[1] = Txtaddempid.Text; dr[2] = Drpadddept.SelectedItem.Text; dt.Rows.Add(dr); GridView1.DataSource = dt; GridView1.DataBind(); Session.Remove("Data"); Session["Data"] = dt;
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)