📄 aspnet13-07.htm
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><html><head><!-- saved from url=(0076)http://msconline.maconstate.edu/tutorials/aspnet20/ASPNET13/aspnet13-07.aspx --><title>ASP.NET Tutorial</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"><link href="aspnet13-07_data/stylesheet.css" type="text/css" rel="stylesheet">
<meta content="MSHTML 6.00.2900.2180" name="GENERATOR"></head><body onscroll="document.all.PageScroll.value=document.body.scrollTop" onload="document.body.scrollTop=document.all.PageScroll.value">
<form id="ctl00" name="ctl00" action="aspnet13-07.aspx" method="post">
<div><input id="__VIEWSTATE" value="/wEPDwULLTIwNDAwODk2OTNkZLMUjA6Q/kkHDznkz8SbH62PpfTL" name="__VIEWSTATE" type="hidden">
</div><input id="PageScroll" style="visibility: hidden; position: absolute;" name="PageScroll">
<div class="divhead">Credit Card Processing</div>
<p>The <span class="code"><b>CreditCheck.aspx</b></span> page is linked from the
<span class="code">SubmitForm.aspx</span> page, having been passed form
information concerning the customer's order. The page shown below is displayed
to collect credit card information and to pass approval and processing results
back to the eCommerce site. This page is assumed to be external to the eCommerce
site. Often times the credit card processing service permits use of logos and
styling schemes to format the page to resemble a page from the merchant
site.</p><img src="aspnet13-07_data/CreditCheck1.gif">
<div class="figure"><b>Figure 13-11.</b> Layout of <span class="code">CreditCheck.aspx</span> page.</div>
<p class="head2">Credit Processing Form</p>
<p>The layout of the <span class="code">CreditCheck.aspx</span> page is shown
below. No special form display or editing controls are used. Standard server
controls are formatted in a table for layout.</p><pre class="divcode"><html>
<head>
<title>Credit Check</title>
<link href="stylesheetEC.css" rel="stylesheet">
</head>
<body>
<form Runat="Server">
<table id="MasterTable" border="0" cellspacing="0" width="100%">
<tr>
<td id="HeaderCell">
webWarehouse.com
</td>
</tr>
</table>
<br/>
<asp:Label id="ReturnURL" Visible="False" Runat="Server"/>
<asp:Label id="Instructions" Runat="Server"
Text="Enter the requested information to complete your order with "/>
<asp:Label id="MerchantID" Font-Bold="True" Runat="Server"/>.<br/><br/>
<table border="0">
<tr>
<th> Customer ID: </th>
<td colspan="5">
<asp:Label id="CustomerID" Runat="Server"
Font-Bold="True"/>
<asp:Label id="Approved" Runat="Server"
ForeColor="#FF0000" Font-Bold="True"/>
</td>
</tr>
<tr>
<th> Order Amount: </th>
<td colspan="5">
<asp:Label id="OrderTotal" Runat="Server"
Font-Bold="True"/></td>
</tr>
<tr>
<td colspan="6"> </td>
</tr>
<tr>
<th> Credit Card: </th>
<td colspan="5">
<asp:DropDownList id="CreditCard" Runat="Server">
<asp:ListItem>Discover</asp:ListItem>
<asp:ListItem>MasterCard</asp:ListItem>
<asp:ListItem>Visa</asp:ListItem>
<asp:ListItem>Discover</asp:ListItem>
</asp:DropDownList>
</td>
</tr>
<tr>
<th> Account: </th>
<td colspan="5">
<asp:TextBox id="Account" Runat="Server"
Text="1111 1111 1111 1111" Size="16" MaxLength="19"/>
</td>
</tr>
<tr>
<th> Expiration Date: </th>
<td colspan="5">
Month:
<asp:DropDownList id="ExpMonth" Runat="Server">
<asp:ListItem>01</asp:ListItem>
<asp:ListItem>02</asp:ListItem>
<asp:ListItem>03</asp:ListItem>
<asp:ListItem>04</asp:ListItem>
<asp:ListItem>05</asp:ListItem>
<asp:ListItem>06</asp:ListItem>
<asp:ListItem>07</asp:ListItem>
<asp:ListItem>08</asp:ListItem>
<asp:ListItem>09</asp:ListItem>
<asp:ListItem>10</asp:ListItem>
<asp:ListItem>11</asp:ListItem>
<asp:ListItem>12</asp:ListItem>
</asp:DropDownList>
Year:
<asp:DropDownList id="ExpYear" Runat="Server">
<asp:ListItem>2003</asp:ListItem>
<asp:ListItem>2004</asp:ListItem>
<asp:ListItem>2005</asp:ListItem>
<asp:ListItem>2006</asp:ListItem>
<asp:ListItem>2007</asp:ListItem>
</asp:DropDownList>
</td>
</tr>
<tr>
<td colspan="6"> </td>
</tr>
<tr>
<th> Name: </th>
<td colspan="5">
<asp:TextBox id="Name" Runat="Server"
Text="Your Name" Size="30" MaxLength="50"/></td>
</tr>
<tr>
<th> Address: </th>
<td colspan="5">
<asp:TextBox id="Address" Runat="Server"
Text="Your Address" Size="30" MaxLength="50"/></td>
</tr>
<tr>
<th> City: </th>
<td><asp:TextBox id="City" Runat="Server"
Text="Your City" Size="30" MaxLength="30"/></td>
<th> State: </th>
<td><asp:TextBox id="State" Runat="Server"
Text="ST" Size="2" MaxLength="2"/></td>
<th> Zip: </th>
<td><asp:TextBox id="Zip" Runat="Server"
Text="55555" Size="10" MaxLength="10"/></td>
</tr>
<tr>
<th> Email: </th>
<td colspan="5">
<asp:TextBox id="Email" Runat="Server"
Text="your@email.net" Size="30" MaxLength="50"/></td>
</tr>
</table><br/>
<asp:Panel id="ContinuePanel" Runat="Server">
<asp:Button id="ContinueButton" Text="Continue Purchase" Runat="Server"
OnClick="CheckCredit"/>
<asp:Button id="CancelButton" Text="Return to Shopping" Runat="Server"
OnClick="Cancel_Order"/>
<asp:Label id="Message" EnableViewState="False" Runat="Server"
style="color:#FF0000"/>
</asp:Panel>
<asp:Panel id="CompletePanel" Visible="False" Runat="Server">
Click to
<asp:Button Text="Complete Order" Runat="Server"
OnClick="Submit_Order"/>
or
<asp:Button Text="Return to Shopping" Runat="Server"
OnClick="Cancel_Order"/>
</asp:Panel>
</form>
</body>
</html>
</pre>
<div class="listing"><b>Listing 13-38.</b> Code for <span class="code">CreditCheck.aspx</span> page.</div>
<p class="head2">Capturing Form Information</p>
<p>This page is linked from the <span class="code">SubmitForm.aspx</span> page
which submits a form to this page containing order information. The <span class="code">Page_Load</span> script for this page captures the submitted
information from the <span class="code">Request.Form</span> collection, using the
specified field names.</p><pre class="divscript"><%@ Page Language="vb" Debug="True"%>
<SCRIPT Runat="Server">
Sub Page_Load
If Not Page.IsPostBack Then
ReturnURL.Text = Request.Form("ReturnURL")
MerchantID.Text = Request.Form("MerchantID")
CustomerID.Text = Request.Form("CustomerID")
OrderTotal.Text = String.Format("{0:C}", Request.Form("OrderTotal"))
End If
End Sub
...
</SCRIPT>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -