Professional Documents
Culture Documents
Modify Shopping Cart Product
Modify Shopping Cart Product
Response.Redirect("EditOrder.aspx?sno=" + GridView1.SelectedRow.Cells[0].Text);
----------------------------
EditOrder.aspx
using System.Data;
using System.Data.SqlClient;
---------------------------
Pageload Coding
---------------------------
if (IsPostBack)
{
}
else
{
if (Request.QueryString["sno"] != null)
{
dt = (DataTable)Session["buyitems"];
if (sr == sr1)
{
Label3.Text = dt.Rows[i]["sno"].ToString();
Label4.Text = dt.Rows[i]["productid"].ToString();
Label5.Text = dt.Rows[i]["productname"].ToString();
DropDownList1.Text = dt.Rows[i]["quantity"].ToString();
Label6.Text = dt.Rows[i]["price"].ToString();
Label7.Text = dt.Rows[i]["totalprice"].ToString();
break;
}
}
}
else
{
}
}
----------------------
DropDownList SelectedIndexChanged
----------------------------------
int q;
q = Convert.ToInt32(DropDownList1.Text);
int cost;
cost = Convert.ToInt32(Label6.Text);
int totalcost;
totalcost = cost * q;
Label7.Text = totalcost.ToString();
----------------------------------
dt = (DataTable)Session["buyitems"];
sr1 = Convert.ToInt32(Label3.Text);
if (sr == sr1)
{
dt.Rows[i]["sno"] = Label3.Text;
dt.Rows[i]["productid"] = Label4.Text;
dt.Rows[i]["productname"] = Label5.Text;
dt.Rows[i]["quantity"] = DropDownList1.Text;
dt.Rows[i]["price"] = Label6.Text;
dt.Rows[i]["totalprice"] = Label7.Text;
dt.AcceptChanges();
break;
}
}
Response.Redirect("AddToCart.aspx");
}
----------------------------------