C#
  Home arrow C# arrow Page 3 - Formatting an Online Shopping Cart/PayPal ...
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 
Mobile Linux 
App Generation ROI 
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#

Formatting an Online Shopping Cart/PayPal System
By: Tann San
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 11
    2006-06-27

    Table of Contents:
  • Formatting an Online Shopping Cart/PayPal System
  • Making it Pretty
  • Padding and Spacing
  • Product Paging

  • 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


    Formatting an Online Shopping Cart/PayPal System - Padding and Spacing


    (Page 3 of 4 )

    If you want to add some space around your rows' content you can implement the CellPadding property, which takes an integer value which simply specifies the amount of room to pad each cell with. This was used on the product listing to space things out, as otherwise the images seemed to run together with the border hidden. There's also the CellSpacing property, which will put space between each cell. The difference is that with padding the cell is grown and its background color and border will be stretched. With spacing this is not the case and you will see the page background (or table background if one is specified) between each cell. They say a picture is worth a thousand words, so here are two screenshots; the first is using CellPadding and the other is using CellSpacing:


    CellPadding


    CellSpacing

    I altered the color of the alternate row so the difference between padding and spacing was clearer.  With the shop design padding was the obvious choice as spacing looks pretty bad, but this really depends on how you implement everything.  On another project spacing might be the appropriate choice.

    Captions

    If you want to display a caption inside the final rendered table you can easily do so via the Caption and CaptionAlign property:

      Caption="Shopping Basket Table"
      CaptionAlign="Left"

    The caption can be used to give your viewers a quick reference to what the table shows and should be kept short.  If you want to provide a deeper explanation for visually impaired users you can use the Summary property.  Wait a minute, there is no summary property for the GridView!  Okay you caught me, there isn't one, but that doesn't stop you putting one there.  There's nothing stopping you from putting the following inside the GridView declaration:

      summary="The shopping basket table is used to show the various items you have chosen from this shop"

    It will still get rendered to the page like this:

    <table class="shopgrid" cellspacing="0" cellpadding="10" summary="The shopping basket table is used to show the various items you have chosen from this shop" Cheese="Good" border="0" id="gvBasket" style="border-collapse:collapse;">

    You can pass a lot of items through like this, which is great.  You can see how the all important cheese attribute has been passed through with no problems.  If you've never used the Caption or Summary attributes before you should check out what the W3C has to say on them here.  As a side note, the caption's "align" property has been deprecated, so you might want to avoid using the GridView's CaptionAlign property.

    More C# Articles
    More By Tann San


       · I'm open to...
       · Has anyone noticed erratic behavior when changing a quantity in the baskets form...
       · Hi, I hadn't noticed that behaviour until you pointed it out. It's due to the first...
       · I found this very helpful, thank you. I just need to figure out how to use products...
     

    C# ARTICLES

    - C# and XML
    - Pointers and Arrays in C#
    - C# 3.0 Extension Methods
    - Overloading Operators in C#
    - Iterators and Nullable Types
    - Patterns and Iterators in C#
    - C# Exceptions
    - Methods in C#
    - Delegates and Events in C#
    - Advanced C#
    - 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...





    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway
    Stay green...Green IT