Mercurial > pub > bltoolkit
diff Demo/Asp.Net/Web/Controls/CreditCardForm.ascx @ 0:f990fcb411a9
Копия текущей версии из github
author | cin |
---|---|
date | Thu, 27 Mar 2014 21:46:09 +0400 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Demo/Asp.Net/Web/Controls/CreditCardForm.ascx Thu Mar 27 21:46:09 2014 +0400 @@ -0,0 +1,75 @@ +<%@ Control AutoEventWireup="true" CodeFile="CreditCardForm.ascx.cs" Inherits="PetShop.Web.CreditCardForm" Language="C#" %> + +<script language="javascript"> +function ClientValidate(source, arguments) + { + var dtNow = new Date(); + var tmp = new String(arguments.Value); + var dtCard = new Date(); + + dtCard.setFullYear(tmp.split("/")[1]); + dtCard.setMonth(tmp.split("/")[0]-1); + dtCard.setDate(30); + + if (dtNow < dtCard) arguments.IsValid = true; + else arguments.IsValid = false; +} +</script> + +<table border="0" cellpadding="0" cellspacing="0" class="track3" width="413"> +<tr><td> </td></tr> +<tr><td> +<div class="label"> + Credit Card Type<br /> + <asp:DropDownList ID="listCctype" runat="server" Width="150px" CssClass="checkoutDropdown"> + <asp:ListItem>Visa</asp:ListItem> + <asp:ListItem>Master Card</asp:ListItem> + <asp:ListItem>American Express</asp:ListItem> + <asp:ListItem>Discovery</asp:ListItem> + </asp:DropDownList> + <br/><br/> +</div> +</td></tr> +<tr><td> +<div class="label"> + Card Number + <br /> + <asp:TextBox ID="txtCcnumber" runat="server" Width="145px" CssClass="checkoutTextbox"></asp:TextBox> + <span class="asterisk">*</span><br /> + <asp:RequiredFieldValidator ID="valRequiredFieldValidator1" runat="server" + ControlToValidate="txtCcnumber" + ErrorMessage="Please enter card number." + Display="Dynamic" /> + <asp:RegularExpressionValidator ID="valRegularExpressionValidator1" runat="server" ControlToValidate="txtCcnumber" + ErrorMessage="Card number invalid." + ValidationExpression="^([0-9]{15,16})$" + Display="Dynamic" /> + <br/> +</div> +</td></tr> +<tr><td> +<div class="label"> + Expiration Date (MM/YYYY) + <br /> + <asp:TextBox ID="txtExpdate" runat="server" Width="70px" CssClass="checkoutTextbox"></asp:TextBox> + <span class="asterisk">*</span><br /> + <asp:RequiredFieldValidator ID="valRequiredFieldValidator2" runat="server" + ControlToValidate="txtExpdate" + ErrorMessage="Please enter expiration date." + Display="Dynamic" /> + <asp:RegularExpressionValidator ID="valRegularExpressionValidator2" runat="server" + ControlToValidate="txtExpdate" + ErrorMessage="Invalid date format." + ValidationExpression="^((0[1-9])|(1[0-2]))\/(\d{4})$" + Display="Dynamic" /> + <asp:CustomValidator ID="valCustomValidator" runat="server" + ClientValidationFunction="ClientValidate" + ControlToValidate="txtExpdate" + Display="Dynamic" + ErrorMessage="Expiration date invalid." + OnServerValidate="ServerValidate" /> + <br/> +</div> +</td> +</tr> +</table>