//public string bindc() //{ // int i = 0, j = 0; // com.CommandText = "select item_name,qty,item_price,cart_id from cart where client_user_id='" + cid + "' AND client_session_id='" + sessionid + "'"; // com.Connection = con; // reader = com.ExecuteReader(); // if (reader.HasRows) // { // while (reader.Read()) // { // } // } // string data = ""; // int total=0; // reader.Close(); // reader = com.ExecuteReader(); // if (reader.HasRows) // { // while (reader.Read()) // { // string name = reader.GetString(0); // int qty = reader.GetInt32(1); // int price = reader.GetInt32(2); // total = total + price; // data += "<ul class='carttablehead'><li class=''>" + name + "</li><li class=''>" + qty + "</li><li class=''>" + price + "</li><li class=''>" + "</li></ul>"; // } // reader.Close(); // } // else // { // data += "<ul class='carttablehead'><li class=''>NO DATA</li></ul>"; // } // //reader.Close(); // return data; //} public void bindtotal() { UpdatePanel1.Update(); Mycart3.Update(); reader.Close(); string data = ""; int total = 0; com.CommandText = "select item_price,qty from cart where client_user_id='" + cid + "' AND client_session_id='" + sessionid + "' AND payment_status='Pending'"; com.Connection = con; reader = com.ExecuteReader(); if (reader.HasRows) { while (reader.Read()) { int pro_price = reader.GetInt32(0); int qty = reader.GetInt32(1); total = total + pro_price * qty; data = "Rs. " + total; } reader.Close(); totalprice.InnerText = data; } else { //UpdatePanel1.Visible = false; //totalprice.Visible = false; checkoutlink.Visible = false; //Response.Redirect("gallery.aspx"); data = "Rs. 0"; reader.Close(); totalprice.InnerText = data + ""; } }
protected void save_ServerClick(object sender, System.EventArgs e) { int k = 0; //System.Threading.Thread.Sleep(3000); //Response.Write("<script>alert(' text=" + text_qty_val + "')</script>"); int changeqty = 0; LinkButton hl = sender as LinkButton; string url = HttpContext.Current.Request.Url.AbsoluteUri; string id = hl.ID; tval = Convert.ToInt32(text_qty_val); cartid1 = Convert.ToInt32(id); //strOriginal.Remove(20, 5); com.CommandText = "update cart set qty=" + tval + " where client_user_id='" + cid + "' AND client_session_id='" + sessionid + "' AND cart_id=" + cartid1; com.Connection = con; //Response.Write("update cart set qty=" + tval + " where client_user_id='" + cid + "' AND client_session_id='" + sessionid + "' AND cart_id=" + cartid); changeqty = com.ExecuteNonQuery(); //Label1.Text = "Panel refreshed at " + //DateTime.Now.ToString(); //if (hl.HasAttributes) //{ // username.InnerText = hl.Attributes.Keys.ToString(); //} if (changeqty > 0) { HyperLink qt = (HyperLink)Page.Form.FindControl("qty_" + id); qt.Text = text_qty_val; HiddenField hd = (HiddenField)Page.Form.FindControl("hide_" + id); string p_price = hd.Value; HtmlGenericControl chli = (HtmlGenericControl)Page.Form.FindControl("pricel" + id); chli.InnerText = (Convert.ToInt32(text_qty_val) * Convert.ToInt32(p_price)).ToString(); bindtotal(); Mycart3.Update(); //Control c = (UpdatePanel)Page.Form.Controls(Mycart); UpdatePanel1.Update(); } else { //Mycart.Update(); //Response.Write("<script>alert('fail ')</script>"); } }