protected void btnaddcart_Click(object sender, EventArgs e) { using (cart obj = new cart()) { if (ViewState["rbtnid"] != null) { obj._productid = Convert.ToInt64(Request.QueryString["sid"].ToString()); obj._ppid = Convert.ToInt64(ViewState["rbtnid"].ToString()); obj._prid = Convert.ToInt64(ViewState["prid"].ToString()); Session["Current"] = Session.SessionID.ToString(); obj._sessionid = Session["Current"].ToString(); obj._orderid = Convert.ToInt64("0"); obj._credit = Convert.ToInt64(lbltotal.Text.ToString()); if (Session["UserID"] != null) { if (Session["UserID"] != "") { obj._userid = Convert.ToInt64(Session["UserID"].ToString()); } } else { obj._userid = Convert.ToInt64("0"); } obj.cart_insert(); Response.Redirect("Cart.aspx"); } else { lblMsg.Visible = true; lblMsg.Text = "Chose one product item"; } } }