TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
alrodean fransmab
NA
36
11k
how to show all items on checkout page
Nov 27 2013 6:58 AM
hello im busy with a practical i got i came quite far using a template as a layout but i have a issue i am facing.
I can add items to a cart all good and well but when i checkout i want to be able to remove unwanted items. i have my code to add the items to a cart i taught myself ajax just to add the items together but on the checkout page i don't know how to show all the items in the cart, i use sessions as well. I'm in my first year so things are still new to me here
Here is my code :
<%@ Page Language="C#" MasterPageFile="~/Site1.Master" AutoEventWireup="true" CodeBehind="Meat.aspx.cs" Inherits="Dial_A_Braai.Meat" Title="Untitled Page" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<div class="center_content">
<div class="oferta" style="background-color: #FFFFFF;">
<img src="Pics/Rice.jpg" width="165" height="113" border="0" class="oferta_img"
alt="" style="background-color: #FFFFFF" />
<div class="oferta_details" style="background-color: #FFFFFF">
<div class="oferta_title">10 & More Servings....</div>
<div class="oferta_text"> When buying 10 items from us, you will receive a free salad of your choice with your purchase. you can view the salads in the "Salads" section under Catergories </div>
</div>
</div>
<div class="center_title_bar">Meat</div>
<div class="prod_box">
<div class="center_prod_box">
<div class="product_title">T-Boned-Steak</div>
<div class="product_img"><img src="Pics/T-Bone.jpg" width="94px" height="71px" alt="" border="0" /></div>
<div class="prod_price"> <span class="price">R30.00</span></div>
</div>
<div class="prod_details_tab" align="center">
<asp:LinkButton ID="btnBuy4" runat="server" CssClass="prod_buy"
onclick="btnBuy4_Click">Add to Tray</asp:LinkButton> </div>
</div>
<div class="prod_box">
<div class="center_prod_box">
<div class="product_title">Baby T-Boned Steak</div>
<div class="product_img"><img src="Pics/Baby.jpg" alt="" border="0" width="94px" height="71px" /></div>
<div class="prod_price"> <span class="price">R20.00</span></div>
</div>
<div class="prod_details_tab"><asp:LinkButton ID="btnBuy5" runat="server"
CssClass="prod_buy" onclick="btnBuy5_Click">Add to Tray</asp:LinkButton>
</div>
</div>
<div class="prod_box">
<div class="center_prod_box">
<div class="product_title">Lamb Loin Chop</div>
<div class="product_img"><img src="Pics/Loin.jpg" alt="" border="0" width="94px" height="71px" /></div>
<div class="prod_price"> <span class="price">R125.00</span></div>
</div>
<div class="prod_details_tab">
<asp:LinkButton ID="btnBuy6" runat="server" CssClass="prod_buy"
onclick="btnBuy6_Click">Add to Tray</asp:LinkButton> </div>
</div>
<div class="prod_box">
<div class="center_prod_box">
<div class="product_title">Lamb Chump Chops</div>
<div class="product_img"><img src="Pics/Chump.jpg" alt="" border="0" width="94px" height="71px" /></div>
<div class="prod_price"> <span class="price">R125.00</span></div>
</div>
<div class="prod_details_tab">
<asp:LinkButton ID="btnBuy7" runat="server" CssClass="prod_buy"
onclick="btnBuy7_Click">Add to Tray</asp:LinkButton> </div>
</div>
<div class="prod_box">
<div class="center_prod_box">
<div class="product_title">Steak-Tenderized</div>
<div class="product_img"><img src="Pics/tenderized.jpg" alt="" border="0" width="94px" height="71px"/></div>
<div class="prod_price"> <span class="price">R120.00</span></div>
</div>
<div class="prod_details_tab">
<asp:LinkButton ID="btnBuy8" runat="server" CssClass="prod_buy"
onclick="btnBuy8_Click">Add to Tray</asp:LinkButton> </div>
</div>
<div class="prod_box">
<div class="center_prod_box">
<div class="product_title">Rump Steak</div>
<div class="product_img"><img src="Pics/FilletSteak.jpg" alt="" border="0" width="94px" height="71px"/></div>
<div class="prod_price"> <span class="price">R120.00</span></div>
</div>
<div class="prod_details_tab">
<asp:LinkButton ID="btnBuy9" runat="server" CssClass="prod_buy"
onclick="btnBuy9_Click">Add to Tray</asp:LinkButton> </div>
</div>
<div class="prod_box">
<div class="center_prod_box">
<div class="product_title">Steak Fillet</div>
<div class="product_img"><img src="Pics/FilletSteak.jpg" alt="" border="0" width="94px" height="71px" /></div>
<div class="prod_price"> <span class="price">R140.00</span></div>
</div>
<div class="prod_details_tab">
<asp:LinkButton ID="btnBuy10" runat="server" CssClass="prod_buy"
onclick="btnBuy10_Click">Add to Tray</asp:LinkButton> </div>
</div>
<div class="prod_box">
<div class="center_prod_box">
<div class="product_title">Spare Rips</div>
<div class="product_img"><img src="Pics/Ribs.jpg" alt="" border="0" width="94px" height="71px" /></div>
<div class="prod_price"> <span class="price">R140.00</span></div>
</div>
<div class="prod_details_tab">
<asp:LinkButton ID="btnBuy11" runat="server" CssClass="prod_buy"
onclick="btnBuy11_Click">Add to Tray</asp:LinkButton> </div>
</div>
<div class="prod_box">
<div class="center_prod_box">
<div class="product_title">Sausage</div>
<div class="product_img"><img src="Pics/Sausage.jpg" alt="" border="0" width="94px" height="71px" /></div>
<div class="prod_price"> <span class="price">R85.00</span></div>
</div>
<div class="prod_details_tab">
<asp:LinkButton ID="btnBuy12" runat="server" CssClass="prod_buy"
onclick="btnBuy12_Click">Add to Tray</asp:LinkButton></div>
</div>
</div>
<div class="right_content">
<div class="shopping_cart">
<div class="title_box">Dinner Tray</div>
<div class="cart_details"><asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:Label ID="lblQuantity" runat="server">0</asp:Label> items <br />
<span class="border_cart"></span> Total: <span class="price">
<asp:Label ID="lblRand" runat="server" Text="R"></asp:Label>
<asp:Label ID="lblTotal" runat="server" Text="0.00"></asp:Label></span> </ContentTemplate>
<Triggers >
<asp:AsyncPostBackTrigger ControlID="btnBuy4" EventName="Click" />
<asp:AsyncPostBackTrigger ControlID="btnBuy5" EventName="Click" />
<asp:AsyncPostBackTrigger ControlID="btnBuy6" EventName="Click" />
<asp:AsyncPostBackTrigger ControlID="btnBuy7" EventName="Click" />
<asp:AsyncPostBackTrigger ControlID="btnBuy8" EventName="Click" />
<asp:AsyncPostBackTrigger ControlID="btnBuy9" EventName="Click" />
<asp:AsyncPostBackTrigger ControlID="btnBuy10" EventName="Click" />
<asp:AsyncPostBackTrigger ControlID="btnBuy11" EventName="Click" />
<asp:AsyncPostBackTrigger ControlID="btnBuy12" EventName="Click" />
</Triggers>
</asp:UpdatePanel></div>
<div class="cart_icon"><img src="images/shoppingcart.png" alt="" width="35" height="35" border="0" /></div>
</div>
<div class="title_box">What's new</div>
<div class="border_box">
<div class="product_title">
</a>Combo 3</div>
<div class="product_img"><img src="images/p2.jpg" alt="" border="0" /></div>
<div class="prod_price"> <span class="price">R65.00</span></div>
</div>
</div>
</asp:Content>
Code behind :
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Xml.Linq;
namespace Dial_A_Braai
{
public partial class Meat : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
string x = Convert.ToString(Session["total"]);
string y = Convert.ToString(Session["qauntity"]);
if (x == "")
{
lblTotal.Text = "0.00";
lblQuantity.Text = "0";
}
else
{
lblQuantity.Text = y;
lblTotal.Text = x;
}
}
protected void btnBuy4_Click(object sender, EventArgs e)
{
double total = Convert.ToDouble(lblTotal.Text);
int qauntity = Convert.ToInt32(lblQuantity.Text);
qauntity += 1;
lblQuantity.Text = qauntity.ToString();
total += 30.00;
lblTotal.Text = total.ToString();
Session["total"] = lblTotal.Text;
Session["qauntity"] = lblQuantity.Text;
}
protected void btnBuy5_Click(object sender, EventArgs e)
{
double total = Convert.ToDouble(lblTotal.Text);
int qauntity = Convert.ToInt32(lblQuantity.Text);
qauntity += 1;
lblQuantity.Text = qauntity.ToString();
total += 20.00;
lblTotal.Text = total.ToString();
Session["total"] = lblTotal.Text;
Session["qauntity"] = lblQuantity.Text;
}
protected void btnBuy6_Click(object sender, EventArgs e)
{
double total = Convert.ToDouble(lblTotal.Text);
int qauntity = Convert.ToInt32(lblQuantity.Text);
qauntity += 1;
lblQuantity.Text = qauntity.ToString();
total += 125.00;
lblTotal.Text = total.ToString();
Session["total"] = lblTotal.Text;
Session["qauntity"] = lblQuantity.Text;
}
protected void btnBuy7_Click(object sender, EventArgs e)
{
double total = Convert.ToDouble(lblTotal.Text);
int qauntity = Convert.ToInt32(lblQuantity.Text);
qauntity += 1;
lblQuantity.Text = qauntity.ToString();
total += 125.00;
lblTotal.Text = total.ToString();
Session["total"] = lblTotal.Text;
Session["qauntity"] = lblQuantity.Text;
}
protected void btnBuy8_Click(object sender, EventArgs e)
{
double total = Convert.ToDouble(lblTotal.Text);
int qauntity = Convert.ToInt32(lblQuantity.Text);
qauntity += 1;
lblQuantity.Text = qauntity.ToString();
total += 120.00;
lblTotal.Text = total.ToString();
Session["total"] = lblTotal.Text;
Session["qauntity"] = lblQuantity.Text;
}
protected void btnBuy9_Click(object sender, EventArgs e)
{
double total = Convert.ToDouble(lblTotal.Text);
int qauntity = Convert.ToInt32(lblQuantity.Text);
qauntity += 1;
lblQuantity.Text = qauntity.ToString();
total += 120.00;
lblTotal.Text = total.ToString();
Session["total"] = lblTotal.Text;
Session["qauntity"] = lblQuantity.Text;
}
protected void btnBuy10_Click(object sender, EventArgs e)
{
double total = Convert.ToDouble(lblTotal.Text);
int qauntity = Convert.ToInt32(lblQuantity.Text);
qauntity += 1;
lblQuantity.Text = qauntity.ToString();
total += 140.00;
lblTotal.Text = total.ToString();
Session["total"] = lblTotal.Text;
Session["qauntity"] = lblQuantity.Text;
}
protected void btnBuy11_Click(object sender, EventArgs e)
{
double total = Convert.ToDouble(lblTotal.Text);
int qauntity = Convert.ToInt32(lblQuantity.Text);
qauntity += 1;
lblQuantity.Text = qauntity.ToString();
total += 140.00;
lblTotal.Text = total.ToString();
Session["total"] = lblTotal.Text;
Session["qauntity"] = lblQuantity.Text;
}
protected void btnBuy12_Click(object sender, EventArgs e)
{
double total = Convert.ToDouble(lblTotal.Text);
int qauntity = Convert.ToInt32(lblQuantity.Text);
qauntity += 1;
lblQuantity.Text = qauntity.ToString();
total += 85.00;
lblTotal.Text = total.ToString();
Session["total"] = lblTotal.Text;
Session["qauntity"] = lblQuantity.Text;
}
}
}
this code is for one of my pages that add items to cart. I don't want answers just some guidance on what tool to use maybe. It's pointless getting answers meaning i don't learn anything.
Thank you in advance
Reply
Answers (
0
)
how to apply oops concepts in realtime scenarious
Session in .ashx file