public void BindtoGrid() { if (Session["pid"] != null) { string prid = Session["pid"].ToString(); if (Session["count"] != null) { LinkButton lblcount = (LinkButton)Master.FindControl("lblcount"); lblcount.Text = Session["count"].ToString(); } if (prid != "") { List <Products> lstp = new Products().GetCartProductDetails(prid, 1); //foreach (Products spv in lstp) //{ // lstcartp.Add(spv); //} lstcartp = lstp; } hdnCount.Value = lstcartp.Count.ToString(); CartGridview.DataSource = lstcartp; CartGridview.DataBind(); Session["lstfinalCartData"] = lstcartp; } else { Response.Redirect("Default.aspx"); } }
public void BindtoGrid() { List <Products> newlist = new List <Products>(); if (Session["pid"] != null) { string prid = Session["pid"].ToString(); if (Session["count"] != null) { LinkButton lblcount = (LinkButton)Master.FindControl("lblcount"); lblcount.Text = Session["count"].ToString(); } string userid = ""; if (Session["UserAccountID"] != null) { userid = Session["UserAccountID"].ToString(); } string OrderId = ""; if (Session["OrderId"] != null) { OrderId = Session["OrderId"].ToString(); } List <Orders> lstOrder = new Orders().GetOrders(OrderId, userid, "", "", "", "", "", " order by OrderDateTime desc"); if (lstOrder != null) { CartGridview.DataSource = lstOrder[0].lstDetails; CartGridview.DataBind(); Session["lstfinalCartData"] = lstOrder[0].lstDetails; } } else { Response.Redirect("Default.aspx"); } }