comparison Demo/Asp.Net/Web/Controls/CreditCardForm.ascx @ 0:f990fcb411a9

Копия текущей версии из github
author cin
date Thu, 27 Mar 2014 21:46:09 +0400
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:f990fcb411a9
1 <%@ Control AutoEventWireup="true" CodeFile="CreditCardForm.ascx.cs" Inherits="PetShop.Web.CreditCardForm" Language="C#" %>
2
3 <script language="javascript">
4 function ClientValidate(source, arguments)
5 {
6 var dtNow = new Date();
7 var tmp = new String(arguments.Value);
8 var dtCard = new Date();
9
10 dtCard.setFullYear(tmp.split("/")[1]);
11 dtCard.setMonth(tmp.split("/")[0]-1);
12 dtCard.setDate(30);
13
14 if (dtNow < dtCard) arguments.IsValid = true;
15 else arguments.IsValid = false;
16 }
17 </script>
18
19 <table border="0" cellpadding="0" cellspacing="0" class="track3" width="413">
20 <tr><td>&nbsp;</td></tr>
21 <tr><td>
22 <div class="label">
23 Credit Card Type<br />
24 <asp:DropDownList ID="listCctype" runat="server" Width="150px" CssClass="checkoutDropdown">
25 <asp:ListItem>Visa</asp:ListItem>
26 <asp:ListItem>Master Card</asp:ListItem>
27 <asp:ListItem>American Express</asp:ListItem>
28 <asp:ListItem>Discovery</asp:ListItem>
29 </asp:DropDownList>
30 <br/><br/>
31 </div>
32 </td></tr>
33 <tr><td>
34 <div class="label">
35 Card Number
36 <br />
37 <asp:TextBox ID="txtCcnumber" runat="server" Width="145px" CssClass="checkoutTextbox"></asp:TextBox>
38 <span class="asterisk">*</span><br />
39 <asp:RequiredFieldValidator ID="valRequiredFieldValidator1" runat="server"
40 ControlToValidate="txtCcnumber"
41 ErrorMessage="Please enter card number."
42 Display="Dynamic" />
43 <asp:RegularExpressionValidator ID="valRegularExpressionValidator1" runat="server" ControlToValidate="txtCcnumber"
44 ErrorMessage="Card number invalid."
45 ValidationExpression="^([0-9]{15,16})$"
46 Display="Dynamic" />&nbsp;
47 <br/>
48 </div>
49 </td></tr>
50 <tr><td>
51 <div class="label">
52 Expiration Date (MM/YYYY)
53 <br />
54 <asp:TextBox ID="txtExpdate" runat="server" Width="70px" CssClass="checkoutTextbox"></asp:TextBox>
55 <span class="asterisk">*</span><br />
56 <asp:RequiredFieldValidator ID="valRequiredFieldValidator2" runat="server"
57 ControlToValidate="txtExpdate"
58 ErrorMessage="Please enter expiration date."
59 Display="Dynamic" />
60 <asp:RegularExpressionValidator ID="valRegularExpressionValidator2" runat="server"
61 ControlToValidate="txtExpdate"
62 ErrorMessage="Invalid date format."
63 ValidationExpression="^((0[1-9])|(1[0-2]))\/(\d{4})$"
64 Display="Dynamic" />
65 <asp:CustomValidator ID="valCustomValidator" runat="server"
66 ClientValidationFunction="ClientValidate"
67 ControlToValidate="txtExpdate"
68 Display="Dynamic"
69 ErrorMessage="Expiration date invalid."
70 OnServerValidate="ServerValidate" />&nbsp;
71 <br/>
72 </div>
73 </td>
74 </tr>
75 </table>