C#
  Home arrow C# arrow Page 2 - Creating an Online Shopping Cart and PayPa...
ASP Free Forums 
.NET  
ASP  
ASP Code  
ASP.NET  
ASP.NET Code  
BrainDump  
C#  
Code Examples  
Database  
Database Code  
IIS  
Microsoft Access  
MS SQL Server  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
ASP Web Hosting  
ASP.NET Web Hosting 
Dedicated Servers 
Moblin 
JMSL Numerical Library 
Windows Web Hosting
 
IBM® developerWorks 
Sun Developer Network 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
C#

Creating an Online Shopping Cart and PayPal System
By: Tann San
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 28
    2006-06-13

    Table of Contents:
  • Creating an Online Shopping Cart and PayPal System
  • The GridView
  • The Page Declaration
  • An Important Function

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Creating an Online Shopping Cart and PayPal System - The GridView


    (Page 2 of 4 )

    If you've already implemented your system using DataGrids, including your own custom paging and sorting solutions, then you really don't need to consider updating to the GridView because, end functionality-wise, they both produce the same thing (i.e an HTML table).  If however you're starting a new system, then you should go with the GridView, especially if you want to take advantage of its built-in paging and sorting abilities.

    You can control several aspects of the GridView, from how it looks to how it functions, by setting various properties at design time. Later in this article series we will look into these areas more deeply by assigning some CSS classes to the table rows and table column headers, as well as adding some event handlers to allow user interactions with each row.

    Populating the GridView is identical to populating a DataGrid. You create your DataSource and then bind it to the GridView with:

      myGridView.DataSource = yourDataSource;
      myGridView.DataBind();

    With .net 2 you have another option, which is to create a SqlDataSource and bind the GridView directly to that by setting its DataSourceID to match the ID you assign to the SqlDataSource, i.e:

      <!-- Create the SqlDataSource with the ID of mySqlDataSource -->
      <asp:SqlDataSource
       
    id="mySqlDataSource"
       
    runat="server"
        DataSourceMode="DataReader"
        ConnectionString="<%$ ConnectionStrings:MyNorthwind%>"
        SelectCommand="SELECT LastName FROM Employees">
      </asp:SqlDataSource>

      <!-- Create the GridView and assign its DataSourceID to match the above i.e. mySqlDataSource -->
      <asp:GridView
        id="myGridView"
        runat="server"
        autogeneratecolumns="true"
        DataSourceID="mySqlDataSource"/>

    Personally I'm not that keen on this method, although it is "the recommended" method by Microsoft to set up your GridView.  I prefer to have more control over my DataSource so I can manually filter its contents and more, which is why we won't be using this method in the demo shop.

    So let's dive into constructing the demonstration shop.  The outline for the shop is that there will be two GridViews on a single page; you can see this in the introduction image. One GridView will be used to display the products in our shop and the other will be the shopping basket.  You could easily split these two up onto their own pages, but for the sake of simplicity here we'll keep them together.

    If you open default.aspx which is included in the zip file that accompanies this article, you can see how the page has been set up. Most of the HTML is just pretty wrapping; the bits to pay attention to are the page declaration at the top, the main <form> tag and the pair of <GridView> tags inside it.

    More C# Articles
    More By Tann San


       · Hey, I'm open to...
       · for some reason it wont work on my server do i have to have an asp server?
       · Hiya, you need to make sure you have the Microsoft .net Framework v1 and v2...
       · I am wondering if you could show an example of how to calculate the delivery costs...
     

    C# ARTICLES

    - Working with Regular Expressions in C#
    - Sending Simple E-Mail in C#
    - Building C# Comparable Objects: IComparable ...
    - Color Transformation Applications in C# GDI+...
    - Performing Color Transformation Operations i...
    - Color Transformation in C# GDI+ Programming
    - Exceptions in C#
    - Overriding versus Overloading
    - Value Types and Reference Types
    - Defining Member and Type Visibility
    - Managing Files in C#
    - Working with Windows Registry in C#
    - Lossless Image Resizing in C#
    - Lossless Image Converting in C#
    - Creating an RSS Feed with ASP.Net Written in...





    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway