Click here to Skip to main content
15,886,258 members
Articles / Web Development / ASP.NET

Simple Shopping Cart (Basket ) User Control using ASP.NET & JavaScript (Floating, Movable and Resizable)

Rate me:
Please Sign up or sign in to vote.
4.84/5 (54 votes)
25 May 2011CPOL7 min read 244.7K   25.7K   105  
A simple and easy way to add shopping cart to your website and start using it
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.IO ;
using System.Configuration;

public partial class _Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            
            // the shopping items saved in XML file to make it easy for testing the application
            // note that it use to saved in database in real live scenario
            string myXMLfile = "XMLFile.xml";

            DataSet ds = new DataSet();
            // Create new FileStream with which to read the schema.
            System.IO.FileStream fsReadXml = new System.IO.FileStream
            (myXMLfile, System.IO.FileMode.Open);
            ds.ReadXml(fsReadXml);
            GridView1.DataSource = ds.Tables[0];
            GridView1.DataBind();
            fsReadXml.Close();
        }
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Architect
Saudi Arabia Saudi Arabia
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions