Jump to content

New to asp.net


BigAl75

Recommended Posts

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

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...