DataTable dt;
protected void Page_Load(object sender, EventArgs e)
{
if(Session["dt"]!=null)
{
dt=(DataTable)Session["dt"];
}
else
{
dt = new DataTable();
dt.Columns.Add("Product", typeof(string));
dt.Columns.Add("Watt", typeof(string));
dt.Columns.Add("Duration", typeof(Int32));
}
GridView1.DataSource = dt;
GridView1.DataBind();
}
protected void submit_Click(object sender, EventArgs e)
{
DataTable dt2 =new DataTable();
if(Session["dt"]!=null)
{
dt2=(DataTable)Session["dt"];
}
DataRow dr = dt2.NewRow();
dr["Product"] = DropDownList1.Text;
dr["Watt"] = Txtwatt.Text;
dr["Duration"] = TxtDuration.Text;
dt2.Rows.Add(dr);
Session["dt"]=dt2;
}