protected void btnBookSeat_Click(object sender, EventArgs e) { if (Session["basket"] != null) { Basket_DataTable = (DataTable)Session["basket"]; Basket_DataTable.Rows.Add(new object[] { ddlFromCity.Text, lblPrice.Text, txtJdate.Text, cblTime.Text, ddlSeat.Text }); Session["basket"] = Basket_DataTable; GridView1.DataSource = Basket_DataTable; GridView1.DataBind(); } else { //create an empty DataTable and Add some columns to it Basket_DataTable = new DataTable(); Basket_DataTable.Columns.Add("BusRouteID", typeof(string)); Basket_DataTable.Columns.Add("Price", typeof(double)); Basket_DataTable.Columns.Add("Date", typeof(string)); Basket_DataTable.Columns.Add("Time", typeof(string)); Basket_DataTable.Columns.Add("SeatNo", typeof(string)); Basket_DataTable.Columns.Add("Total", typeof(string)); Basket_DataTable.Rows.Add(new object[] { ddlFromCity.Text, lblPrice.Text, txtJdate.Text, cblTime.Text, ddlSeat.Text, }); Session["basket"] = Basket_DataTable; GridView1.DataSource = Basket_DataTable; GridView1.DataBind(); } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)