Click here to Skip to main content
13,254,754 members (49,985 online)
Click here to Skip to main content
Add your own
alternative version


151 bookmarked
Posted 20 Apr 2004

Shopping Cart using C#.NET, Web Forms and SQL Server

, 20 Apr 2004
Rate this:
Please Sign up or sign in to vote.
Shopping cart using C#.NET, Web Forms and SQL Server.


This application is a Shopping Cart where users can select items and place an order. I have added the features of login, and adding new users if user does not exist. Validations are performed wherever needed like email format validation, zipcode etc.

Fig. 1

Database: For the purpose, I have used the NorthWind database and SQL Server.

The two main tables used are:

  1. Products table
  2. Order Details table.

I have used two classes:

public class CartRow
    public string id;
    public string name;
    public string price;
    public string items;
public class Cart
    public System.Collections.ArrayList list = new ArrayList(20);

The two main web-forms are Main.aspx and CheckOut.aspx. Main.aspx contains a grid showing all items present in the products table along with the price per unit and the quantity per unit. Fig 1 shows the Main.aspx page, where user can select items from the products grid (left). As he selects an item, it is added to his cart and the item is displayed in the right panel. The total price is displayed in the label above. As the user adds more items to his cart, the recalculated price is shown. Upon clicking the clear cart button, the cart gets empty.

If the user now wants to finalize the order and presses the CheckOut button, he is redirected to the Login.aspx page (Fig 2). I have set the default username as “user” for the sample and password is “u”.

Fig 2.

And finally, the user is asked to enter the Credit Card number, billing PIN code and his email address. It does the client side validations and then confirms the order placed by sending a mail to the user as shown in (Fig 3).

And the order is finalized. For more advanced shopping cart, this information plus the item information has to be stored in some database.

Fig 3


This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


About the Author

Web Developer
United States United States
No Biography provided

You may also be interested in...


Comments and Discussions

Questiondatabase please Pin
Member 134513017-Oct-17 4:35
memberMember 134513017-Oct-17 4:35 
Questiondatabase required Pin
Member 129826194-Feb-17 5:47
memberMember 129826194-Feb-17 5:47 
Questionhi Pin
Member 1284580911-Nov-16 7:50
memberMember 1284580911-Nov-16 7:50 
QuestionExcellent Project Pin
Member 1242474722-Sep-16 16:53
memberMember 1242474722-Sep-16 16:53 
QuestionDATABASE Pin
barakkadosh6-Oct-15 0:05
memberbarakkadosh6-Oct-15 0:05 
Questiondatabase Pin
Member 1186822128-Jul-15 0:15
memberMember 1186822128-Jul-15 0:15 
QuestionDatabase Required Pin
Ankush Mahajan0471-Jul-15 22:27
memberAnkush Mahajan0471-Jul-15 22:27 
QuestionDatabase Pin
Member 1135379017-Apr-15 9:34
memberMember 1135379017-Apr-15 9:34 
QuestionQuestion & Requesting for Database Pin
Member 1147412523-Feb-15 15:31
memberMember 1147412523-Feb-15 15:31 
Generali need your help if you can Pin
Member 1131694021-Dec-14 22:10
memberMember 1131694021-Dec-14 22:10 
QuestionDatabase Required Pin
Member 22853789-Dec-14 3:38
memberMember 22853789-Dec-14 3:38 
Questiondatabase Pin
rajusingh09228-Oct-14 0:47
memberrajusingh09228-Oct-14 0:47 
Questionany one help me tomorrow review last date Pin
Member 110514198-Oct-14 5:06
memberMember 110514198-Oct-14 5:06 
QuestionRe: Database Pin
Member 110514198-Oct-14 5:05
memberMember 110514198-Oct-14 5:05 
QuestionRegarding About Database Pin
Gharuboy27-Sep-14 2:06
memberGharuboy27-Sep-14 2:06 
AnswerRe: Regarding About Database Pin
Member 110514198-Oct-14 5:05
memberMember 110514198-Oct-14 5:05 
Questionregarding to database Pin
Member 107864643-May-14 4:24
memberMember 107864643-May-14 4:24 
Questiondatabase request Pin
Member 1033854630-Mar-14 10:12
memberMember 1033854630-Mar-14 10:12 
please send the's really email-id is
QuestionDatabase Missing Pin
bitsshah_html20-Feb-14 20:20
memberbitsshah_html20-Feb-14 20:20 
GeneralMy review and request regarding database Pin
ApoorvSrivastava14-Feb-14 21:56
memberApoorvSrivastava14-Feb-14 21:56 
QuestionDatabase Pin
Thameeraviraj20-Jan-14 17:49
memberThameeraviraj20-Jan-14 17:49 
GeneralDatabase Pin
babak.ebi4-Nov-13 6:41
memberbabak.ebi4-Nov-13 6:41 
GeneralRe: Database Pin
Member 110514198-Oct-14 5:04
memberMember 110514198-Oct-14 5:04 
QuestionData Base Pin
nawarfattah1-Nov-13 0:35
membernawarfattah1-Nov-13 0:35 
QuestionDatabase Pin
Member 102478026-Oct-13 8:24
memberMember 102478026-Oct-13 8:24 
QuestionDatabase request. Pin
Ord Lampang7-Aug-13 1:49
memberOrd Lampang7-Aug-13 1:49 
GeneralMy vote of 3 Pin
loveupoo14-Jun-13 22:10
memberloveupoo14-Jun-13 22:10 
QuestionDatabase Pin
Member 998990619-Apr-13 7:28
memberMember 998990619-Apr-13 7:28 
QuestionDatabase Pin
Member 888282218-Apr-13 3:02
memberMember 888282218-Apr-13 3:02 
Questiondatabase Pin
wu724458225-Mar-13 18:14
memberwu724458225-Mar-13 18:14 
GeneralMy vote of 3 Pin
Archit Patel14-Mar-13 23:08
memberArchit Patel14-Mar-13 23:08 
Questiondatabase Pin
Member 94544502-Jan-13 20:20
memberMember 94544502-Jan-13 20:20 
QuestionDatabase Mail. Pin
workoholic917-Dec-12 4:42
memberworkoholic917-Dec-12 4:42 
QuestionVery bad Article Pin
Member 963020429-Nov-12 2:07
memberMember 963020429-Nov-12 2:07 
AnswerRe: Very bad Article Pin
doris from South Africa8-Aug-13 13:06
memberdoris from South Africa8-Aug-13 13:06 
QuestionAdd To Cart Pin
fahad.13-Oct-12 3:11
memberfahad.13-Oct-12 3:11 
Questiondatabase Pin
fahad.12-Oct-12 20:02
memberfahad.12-Oct-12 20:02 
Questionits not working Pin
faezajackson29-Sep-12 19:33
memberfaezajackson29-Sep-12 19:33 
QuestionRequest for Database Pin
Member 843501415-Sep-12 4:12
memberMember 843501415-Sep-12 4:12 
QuestionRequire database Pin
Member 93439958-Aug-12 5:26
memberMember 93439958-Aug-12 5:26 
QuestionRequest for database and code Pin
Atul.Sharma0088-Aug-12 0:10
memberAtul.Sharma0088-Aug-12 0:10 
QuestionRequest for database Pin
Steve Pearson17-Jun-12 15:39
memberSteve Pearson17-Jun-12 15:39 
AnswerRe: Request for database and code Pin
ktnotoch3-Feb-13 21:48
memberktnotoch3-Feb-13 21:48 
Questionrequest for the database Pin
Mark Norman11-Jun-12 4:18
memberMark Norman11-Jun-12 4:18 
QuestionRegarding Database Pin
fahedk4-Jun-12 23:08
memberfahedk4-Jun-12 23:08 
GeneralMy vote of 2 Pin
saeedm1227-Feb-12 11:19
membersaeedm1227-Feb-12 11:19 
Questiondatabase Pin
durllavi14-Feb-12 23:07
memberdurllavi14-Feb-12 23:07 
Questiondatabase Pin
vinay chauhan4204-Feb-12 19:44
membervinay chauhan4204-Feb-12 19:44 
Questiondatabase Pin
varsti30-Jan-12 2:46
membervarsti30-Jan-12 2:46 
Questionhi Pin
saranyajana22-Jan-12 22:43
membersaranyajana22-Jan-12 22:43 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.171114.1 | Last Updated 21 Apr 2004
Article Copyright 2004 by ShruSri
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid