BigAl75 Posted March 24, 2006 Share Posted March 24, 2006 Was wondering if someone could look at this and tell me what it is I did wrong. It's supposed to ask for a name (required), CC number (required) expiration date (required, set format). It doesn't like the line:"sub submit(sender As Object, e As EventArgs)" (line 6)and I don't know why.Thanks for the help.Al <%@ Page Language="JScript" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <script runat="server"> sub submit(sender As Object, e As EventArgs) if Page.IsValid then lbl.Text="Thank you!" else lbl.Text="Error!" end if end sub </script><html><body><h2>Enter Your Credit Card Information</h2> <form runat="server"> Cardholder: <asp:TextBox id="name" runat="server" /> <br /><br /> <asp:RequiredFieldValidator ControlToValidate="name" Text="The Cardholder field is required!" runat="server" /> Card number: <asp:TextBox id="txtbox1" runat="server" /> <br /><br /> <asp:Label id="lbl" runat="server" /> <br /> <asp:RegularExpressionValidator ControlToValidate="txtbox1" ValidationExpression="^\d+$" EnableClientScript="false" ErrorMessage="The card number must be 16 numeric digits, with NO spaces or dashes." runat="server" /> Expiration (MM/YY): <asp:TextBox id="txtbox2" runat="server" /> <br /><br /> <asp:Label id="lb2" runat="server" /> <br /> <asp:RegularExpressionValidator ControlToValidate="txtbox2" ValidationExpression="\d{2}/\d{2}" EnableClientScript="false" ErrorMessage="The date format should be in MM/YY format." runat="server" /> Payment type: <asp:DropDownList id="drop1" runat="server"> <asp:ListItem>Visa</asp:ListItem> <asp:ListItem>Master Card</asp:ListItem> <asp:ListItem>American Express</asp:ListItem> <asp:ListItem>Discover</asp:ListItem> </asp:DropDownList> <asp:Button Text="Submit" OnClick="submit" runat="server"/> <br /><br /> <asp:ValidationSummary HeaderText="You must enter a value in the following fields:" DisplayMode="BulletList" EnableClientScript="true" runat="server"/> <br /><br /> <asp:Button runat="server" Text="Submit" /> </form></body></html> Link to comment Share on other sites More sharing options...
aspnetguy Posted March 26, 2006 Share Posted March 26, 2006 You have the language defined as JScript but the code you are writing is VB...that is the problem.I would recommend using either C# or VB...there is far more sample code and support available for those instead of JScript (or J#, I can't remember which it is). Link to comment Share on other sites More sharing options...
BigAl75 Posted March 27, 2006 Author Share Posted March 27, 2006 Oh. Thanks for the help. As I said, I'm new to this. In fact, this is the first ASP.net code I've ever written.Al Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now