Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //LINK I DEN FOREACH I ProduktListe.aspx
- "<a href=\"KurvSys.aspx?id=" + prod.ID + "&func=add\">KØB</a>"
- //KurvSys.aspx
- //KurvSys.aspx.cs
- protected void Page_Load(object sender, EventArgs e)
- {
- if (!string.IsNullOrEmpty(Request.QueryString["func"]))
- {
- string func = Request.QueryString["func"];
- string vare = "vare_" + Request.QueryString["id"];
- if (func == "add")
- {
- if (Session[vare] == null)
- {
- Session[vare] = 1;
- }
- else
- {
- Session[vare] = int.Parse(Session[vare].ToString()) + 1;
- }
- }
- }
- else
- {
- Response.Redirect("Default.aspx");
- }
- Response.Redirect("Kurv.aspx");
- //Kurv.aspx
- <h1 class="underOverskrift">Kurv</h1>
- <asp:Literal ID="litKurv" runat="server"></asp:Literal>
- // Kurv.aspx.cs
- ProduktFac pf = new ProduktFac();
- Produkt p = new Produkt();
- protected void Page_Load(object sender, EventArgs e)
- {
- litKurv.Text += "<table class=\"tableText\"><tr>";
- litKurv.Text += "<td> Navn: </td>";
- litKurv.Text += "<td> + </td>";
- litKurv.Text += "<td> Antal </td>";
- litKurv.Text += "<td> - </td>";
- litKurv.Text += "<td> A. pris </td>";
- litKurv.Text += "<td> Pris: </td>";
- litKurv.Text += "<tr/>";
- foreach (string ses in Session.Contents)
- {
- if (ses.Substring(0, 5) == "vare_")
- {
- int id = int.Parse(ses.Replace("vare_", ""));
- int antal = int.Parse(Session[ses].ToString());
- p = pf.Get(id);
- litKurv.Text += "<tr>";
- litKurv.Text += "<td>" + p.Navn + "</td>";
- litKurv.Text += "<td></td>";
- litKurv.Text += "<td>" + Session[ses].ToString() + "</td>";
- litKurv.Text += "<td></td>";
- litKurv.Text += "<td>" + p.Pris + "</td>";
- litKurv.Text += "<td>" + p.Pris * antal + "</td>";
- litKurv.Text += "<tr/>";
- }
- }
- litKurv.Text += "</table>";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement