Click here to Skip to main content
13,799,685 members
Click here to Skip to main content


576 bookmarked
Posted 14 Jun 2007
Licenced CPOL

Use of the PayPal payment system in ASP.NET

, 2 Jun 2008
This article covers aspects of using the PayPal payment system in ASP.NET
'  File:           Default.aspx
'  Facility:       The unit contains a form allowing goods to be added to a cart.
'  Abstract:       This class is used to display the interface of goods addition to a cart.
'  Environment:    VC 8.0
'  Author:         KB_Soft Group Ltd.

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<html xmlns="">
<head runat="server">
    <title>Untitled Page</title>
    <form id="form1" runat="server">
                    <!-- choosing an identifier of the cart where goods will be added -->
                        <span tabindex="0">Select Cart ID:</span>&nbsp;&nbsp;
                        <asp:DropDownList ID="ddlCartID" runat="server" Width="50">
                            <asp:ListItem Selected="True" Value="1">1</asp:ListItem>
                            <asp:ListItem Value="2">2</asp:ListItem>
                            <asp:ListItem Value="3">3</asp:ListItem>
                            <asp:ListItem Value="4">4</asp:ListItem>
                            <asp:ListItem Value="5">5</asp:ListItem>
                    <!-- The GridView to display a list of goods -->
                        <asp:GridView ID="gvGoods" runat="server" AutoGenerateColumns="False" DataSourceID="odsGoods"
                            CellPadding="5" ForeColor="#333333" DataKeyNames="id">
                                <asp:BoundField DataField="id" HeaderText="#" SortExpression="id" />
                                <asp:BoundField DataField="name" HeaderText="Name" SortExpression="name" />
                                <asp:BoundField DataField="price" HeaderText="Price, $" SortExpression="price" />
                                <asp:TemplateField HeaderText="Quantity">
                                        <table align="right">
                                                <td width="1" style="height: 24px">
                                                    <asp:RequiredFieldValidator ID="vrfQuantity" runat="server" ControlToValidate="txtQuantity"
                                                        CssClass="ValidatorMessage" Display="Dynamic" ErrorMessage="Quantity is required"
                                                        EnableClientScript="False" TabIndex="0">!&nbsp;</asp:RequiredFieldValidator>
                                                    <asp:CompareValidator ID="vQuantity" runat="server" ControlToValidate="txtQuantity"
                                                        Display="Dynamic" ErrorMessage="Quantity is invalid" Type="Integer" Operator="LessThan"
                                                        ValueToCompare="100000000" EnableClientScript="False" TabIndex="0">!</asp:CompareValidator>
                                                <td align="right">
                                                    <asp:TextBox ID="txtQuantity" runat="server" ToolTip="Enter quantity" Width="40px"
                                <asp:ButtonField ButtonType="Button" CommandName="AddToBasket" Text="Add to Basket" />
                            <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                            <RowStyle BackColor="#EFF3FB" />
                            <EditRowStyle BackColor="#2461BF" />
                            <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
                            <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                            <AlternatingRowStyle BackColor="White" />
                    <td align="right">
                        <asp:ImageButton ID="ibEdit" runat="server" ImageUrl="~/Images/viewcart.gif" />
        <!-- The ObjectDataSource to work with the list of goods -->
        <asp:ObjectDataSource ID="odsGoods" runat="server" TypeName="KBSoft.Carts" SelectMethod="LoadAllGoods">

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.


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


About the Author

Alexandr Golovanov
Web Developer
Russian Federation Russian Federation
Alexandr Golovanov is a .NET developer at KB_Soft Group, an offshore software development company located in Russia, Novosibirsk. Here he has worked
on various .NET projects.

You may also be interested in...

Permalink | Advertise | Privacy | Cookies | Terms of Use | Mobile
Web06 | 2.8.181207.3 | Last Updated 3 Jun 2008
Article Copyright 2007 by Alexandr Golovanov
Everything else Copyright © CodeProject, 1999-2018
Layout: fixed | fluid