Okay. I'll post the ASPX and the Codebehind in two blocks. I'm just posting the first page (it's an 8 page form). It's basically the same structure for each page.
THANK YOU!!!!
Aaron
--------------------------Here's the ASPX----------------------------
<%@ Page Language="
vb" AutoEventWireup="false" Codebehind="JobApp1.aspx.
vb" Inherits="JobApplication.WebForm1"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<title>Glide Employment Application</title>
<meta content="False" name="vs_showGrid">
<meta content="True" name="vs_snapToGrid">
<style type="text/css">BODY { FONT-SIZE: 10pt; FONT-FAMILY: arial, helvetica, sans-serif }
</style>
<meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">
<meta content="Visual Basic .NET 7.1" name="CODE_LANGUAGE">
<meta content="JavaScript" name="vs_defaultClientScript">
<meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
</HEAD>
<body MS_POSITIONING="GridLayout">
<form id="Form1" method="post" runat="server">
<asp:label id="Label1" style="Z-INDEX: 101; LEFT: 184px; POSITION: absolute; TOP: 16px" runat="server"
Font-Size="14pt" Font-Names="Arial,Helvetica,sans-serif" Font-Bold="True" Height="40px"
Width="416px">Glide Foundation Employment Application</asp:label><asp:button id="btnNext" style="Z-INDEX: 133; LEFT: 259px; POSITION: absolute; TOP: 480px" tabIndex="12"
runat="server" Text="Next"></asp:button><asp:button id="btnSave" style="Z-INDEX: 135; LEFT: 320px; POSITION: absolute; TOP: 480px" tabIndex="12"
runat="server" Text="Save for Later"></asp:button><asp:label id="lblZip" style="Z-INDEX: 132; LEFT: 528px; POSITION: absolute; TOP: 440px" runat="server"
Font-Size="8pt" Width="26px">Zip</asp:label><asp:label id="lblState" style="Z-INDEX: 131; LEFT: 474px; POSITION: absolute; TOP: 440px"
runat="server" Font-Size="8pt" Width="26px">ST</asp:label><asp:label id="lblCity" style="Z-INDEX: 130; LEFT: 304px; POSITION: absolute; TOP: 440px" runat="server"
Font-Size="8pt" Width="104px">City</asp:label><asp:label id="lblStreet" style="Z-INDEX: 129; LEFT: 136px; POSITION: absolute; TOP: 440px"
runat="server" Font-Size="8pt" Width="104px">Street & Apt.</asp:label><asp:textbox id="tbZip" style="Z-INDEX: 128; LEFT: 528px; POSITION: absolute; TOP: 416px" tabIndex="11"
runat="server" Width="66px" MaxLength="10"></asp:textbox><asp:textbox id="tbState" style="Z-INDEX: 127; LEFT: 472px; POSITION: absolute; TOP: 416px" tabIndex="10"
runat="server" Width="26px" MaxLength="2"></asp:textbox><asp:textbox id="tbCity" style="Z-INDEX: 126; LEFT: 304px; POSITION: absolute; TOP: 416px" tabIndex="9"
runat="server" Width="152px" MaxLength="50"></asp:textbox><asp:textbox id="tbStreet" style="Z-INDEX: 125; LEFT: 138px; POSITION: absolute; TOP: 416px"
tabIndex="8" runat="server" Width="152px" MaxLength="100"></asp:textbox><asp:label id="lblAddress" style="Z-INDEX: 124; LEFT: 32px; POSITION: absolute; TOP: 424px"
runat="server" Height="16px" Width="56px">Address:</asp:label><asp:textbox id="tbEmail" style="Z-INDEX: 123; LEFT: 216px; POSITION: absolute; TOP: 360px" tabIndex="7"
runat="server" Width="90px" MaxLength="50"></asp:textbox><asp:label id="lblEmail" style="Z-INDEX: 122; LEFT: 32px; POSITION: absolute; TOP: 360px" runat="server"
Height="16px" Width="144px">Email Address:</asp:label><asp:label id="lblEveningPhone" style="Z-INDEX: 121; LEFT: 32px; POSITION: absolute; TOP: 328px"
runat="server" Height="16px" Width="168px">Evening Phone Number:</asp:label><asp:textbox id="tbEveningPhone" style="Z-INDEX: 120; LEFT: 216px; POSITION: absolute; TOP: 328px"
tabIndex="6" runat="server" Width="90px" MaxLength="50"></asp:textbox><asp:label id="Label8" style="Z-INDEX: 117; LEFT: 32px; POSITION: absolute; TOP: 296px" runat="server"
Height="16px" Width="144px">Daytime Phone Number:</asp:label><asp:textbox id="tbDaytimePhone" style="Z-INDEX: 119; LEFT: 216px; POSITION: absolute; TOP: 296px"
tabIndex="5" runat="server" Width="90px" MaxLength="50"></asp:textbox><asp:label id="lblDaytimePhone" style="Z-INDEX: 118; LEFT: 32px; POSITION: absolute; TOP: 296px"
runat="server" Height="16px" Width="168px">Daytime Phone Number:</asp:label><asp:label id="lblSocial" style="Z-INDEX: 115; LEFT: 32px; POSITION: absolute; TOP: 264px"
runat="server" Height="16px" Width="168px">Social Security Number:</asp:label><asp:label id="lblMiddle" style="Z-INDEX: 113; LEFT: 440px; POSITION: absolute; TOP: 232px"
runat="server" Font-Size="8pt" Width="104px">Middle</asp:label><asp:label id="lblFirst" style="Z-INDEX: 112; LEFT: 264px; POSITION: absolute; TOP: 232px"
runat="server" Font-Size="8pt" Width="104px">First</asp:label><asp:textbox id="tbMiddleName" style="Z-INDEX: 110; LEFT: 440px; POSITION: absolute; TOP: 208px"
tabIndex="3" runat="server" Width="112px" MaxLength="50"></asp:textbox><asp:textbox id="tbFirstName" style="Z-INDEX: 109; LEFT: 264px; POSITION: absolute; TOP: 208px"
tabIndex="2" runat="server" MaxLength="50"></asp:textbox><asp:textbox id="tbLastName" style="Z-INDEX: 108; LEFT: 80px; POSITION: absolute; TOP: 208px"
tabIndex="1" runat="server" MaxLength="50"></asp:textbox>
<DIV style="DISPLAY: inline; FONT-WEIGHT: bold; Z-INDEX: 103; LEFT: 24px; WIDTH: 184px; FONT-FAMILY: ariel, helvetica, sans-serif; POSITION: absolute; TOP: 160px; HEIGHT: 24px"
ms_positioning="FlowLayout">
<P>Contact Information:</P>
</DIV>
<asp:image id="Image1" style="Z-INDEX: 102; LEFT: 632px; POSITION: absolute; TOP: 16px" runat="server"
Height="96px" Width="136px" ImageUrl="file:///C:\Inetpub\wwwroot\JobApplication\logo_icon.jpg"></asp:image>
<DIV style="DISPLAY: inline; Z-INDEX: 105; LEFT: 600px; WIDTH: 112px; POSITION: absolute; TOP: 160px; HEIGHT: 32px"
ms_positioning="FlowLayout">
<P>Application Date:</P>
</DIV>
<asp:label id="lblDate" style="Z-INDEX: 106; LEFT: 712px; POSITION: absolute; TOP: 160px" runat="server"
Height="24px" Width="130px">Label</asp:label><asp:label id="lblName" style="Z-INDEX: 107; LEFT: 32px; POSITION: absolute; TOP: 208px" runat="server"
Height="16px" Width="40px">Name:</asp:label><asp:label id="lblLast" style="Z-INDEX: 111; LEFT: 80px; POSITION: absolute; TOP: 232px" runat="server"
Font-Size="8pt" Width="104px">Last</asp:label>
<DIV style="DISPLAY: inline; FONT-WEIGHT: bold; Z-INDEX: 114; LEFT: 328px; WIDTH: 112px; FONT-FAMILY: ariel, helvetica, sans-serif; POSITION: absolute; TOP: 128px; HEIGHT: 24px"
ms_positioning="FlowLayout">
<P style="FONT-SIZE: 14pt">Page 1 of 8</P>
</DIV>
<asp:textbox id="tbSocial" style="Z-INDEX: 116; LEFT: 216px; POSITION: absolute; TOP: 264px"
tabIndex="4" runat="server" Width="90px" MaxLength="11"></asp:textbox><asp:label id="lblPageIntro" style="Z-INDEX: 134; LEFT: 24px; POSITION: absolute; TOP: 56px"
runat="server" Height="56px" Width="408px">Please fill out as much information as possible. Leave items blank that do not apply. You may save this application for completion at a later date. This form is secured and confidential.</asp:label><asp:hyperlink id="HyperLink1" style="Z-INDEX: 136; LEFT: 576px; POSITION: absolute; TOP: 215px"
runat="server" Width="136px" NavigateUrl="LoadApplication.aspx">Load Saved Application</asp:hyperlink>
<asp:Label id="lblInvalidEmail" style="Z-INDEX: 137; LEFT: 320px; POSITION: absolute; TOP: 360px"
runat="server" Font-Bold="True" Height="24px" Width="224px" ForeColor="Red" Visible="False">Does not appear to be valid</asp:Label>
<asp:Label id="lblQuery" style="Z-INDEX: 138; LEFT: 352px; POSITION: absolute; TOP: 264px"
runat="server" Width="256px" Height="80px">Label</asp:Label></form>
</body>
</HTML>
-----------------------And Here's the Codebehind--------------------
Imports System.Data
Imports System.Data.OleDb
Public Class WebForm1
Inherits System.Web.UI.Page
Public Structure PageErrors
Public LastName As Boolean
Public FirstName As Boolean
Public Social As Boolean
Public DayPhone As Boolean
Public EvePhone As Boolean
Public Email As Boolean
Public ErrorFlag As Boolean
Sub InitializeErrors()
LastName = False
FirstName = False
Social = False
DayPhone = False
EvePhone = False
Email = False
ErrorFlag = False
End Sub
End Structure
#Region " Web Form Designer Generated Code "
'This call is required by the Web Form Designer.
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
End Sub
Protected WithEvents Label1 As System.Web.UI.WebControls.Label
Protected WithEvents Image1 As System.Web.UI.WebControls.Image
Protected WithEvents lblDate As System.Web.UI.WebControls.Label
Protected WithEvents tbLastName As System.Web.UI.WebControls.TextBox
Protected WithEvents tbFirstName As System.Web.UI.WebControls.TextBox
Protected WithEvents tbMiddleName As System.Web.UI.WebControls.TextBox
Protected WithEvents tbSocial As System.Web.UI.WebControls.TextBox
Protected WithEvents tbDaytimePhone As System.Web.UI.WebControls.TextBox
Protected WithEvents Label8 As System.Web.UI.WebControls.Label
Protected WithEvents tbEveningPhone As System.Web.UI.WebControls.TextBox
Protected WithEvents tbEmail As System.Web.UI.WebControls.TextBox
Protected WithEvents btnNext As System.Web.UI.WebControls.Button
Protected WithEvents tbZip As System.Web.UI.WebControls.TextBox
Protected WithEvents tbState As System.Web.UI.WebControls.TextBox
Protected WithEvents tbCity As System.Web.UI.WebControls.TextBox
Protected WithEvents tbStreet As System.Web.UI.WebControls.TextBox
Protected WithEvents DIV1 As System.Web.UI.HtmlControls.HtmlGenericControl
Protected WithEvents lblZip As System.Web.UI.WebControls.Label
Protected WithEvents lblState As System.Web.UI.WebControls.Label
Protected WithEvents lblCity As System.Web.UI.WebControls.Label
Protected WithEvents lblStreet As System.Web.UI.WebControls.Label
Protected WithEvents lblAddress As System.Web.UI.WebControls.Label
Protected WithEvents lblEmail As System.Web.UI.WebControls.Label
Protected WithEvents lblEveningPhone As System.Web.UI.WebControls.Label
Protected WithEvents lblDaytimePhone As System.Web.UI.WebControls.Label
Protected WithEvents lblSocial As System.Web.UI.WebControls.Label
Protected WithEvents lblMiddle As System.Web.UI.WebControls.Label
Protected WithEvents lblFirst As System.Web.UI.WebControls.Label
Protected WithEvents lblName As System.Web.UI.WebControls.Label
Protected WithEvents lblLast As System.Web.UI.WebControls.Label
Protected WithEvents lblPageIntro As System.Web.UI.WebControls.Label
Public Shared Page1Errors As PageErrors
Public Shared Loaded As Boolean
Public Shared ApplicantID As Int32
Protected WithEvents btnSave As System.Web.UI.WebControls.Button
Protected WithEvents HyperLink1 As System.Web.UI.WebControls.HyperLink
Protected WithEvents lblInvalidEmail As System.Web.UI.WebControls.Label
Protected WithEvents lblQuery As System.Web.UI.WebControls.Label
'NOTE: The following placeholder declaration is required by the Web Form Designer.
'Do not delete or move it.
Private designerPlaceholderDeclaration As System.Object
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeComponent()
End Sub
#End Region
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
lblDate.Text = Today.ToShortDateString.ToString
If Page1Errors.ErrorFlag = True Then
lblPageIntro.Text = "There was a problem with your submission, please correct or enter the fields marked in red."
lblPageIntro.ForeColor = System.Drawing.Color.Red
lblPageIntro.Font.Bold = True
If Page1Errors.LastName = True Then
lblLast.ForeColor = System.Drawing.Color.Red
lblLast.Font.Bold = True
End If
If Page1Errors.FirstName = True Then
lblFirst.ForeColor = System.Drawing.Color.Red
lblFirst.Font.Bold = True
End If
If Page1Errors.Social = True Then
lblSocial.ForeColor = System.Drawing.Color.Red
lblSocial.Font.Bold = True
End If
If Page1Errors.Email = True Then
lblEmail.ForeColor = System.Drawing.Color.Red
lblEmail.Font.Bold = True
lblInvalidEmail.Visible = True
End If
End If
End Sub
Private Sub btnNext_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnNext.Click
'ValidatePage1()
'If Page1Errors.ErrorFlag = True Then Response.Redirect("JobApp1.aspx", True)
SaveToDatabase()
Response.Redirect("JobApp2.aspx", False)
End Sub
Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
ValidatePage1()
SaveToDatabase()
'go to page that prompts for password
End Sub
Sub ValidatePage1()
Page1Errors.InitializeErrors()
If tbLastName.Text = "" Then
Page1Errors.LastName = True
Page1Errors.ErrorFlag = True
End If
If tbFirstName.Text = "" Then
Page1Errors.FirstName = True
Page1Errors.ErrorFlag = True
End If
'Validate Social
Dim strSocial As String = tbSocial.Text
strSocial = Replace(strSocial, "-", "")
strSocial = Replace(strSocial, ".", "")
If Len(strSocial) <> 9 Or Not IsNumeric(strSocial) Then
Page1Errors.Social = True
Page1Errors.ErrorFlag = True
End If
If Not tbEmail.Text = "" Then
If Not IsValidEmail(tbEmail.Text) Then
Page1Errors.Email = True
Page1Errors.ErrorFlag = True
End If
End If
End Sub
Function IsValidEmail(ByVal email) As Boolean
Dim EmailRegex As New System.Text.RegularExpressions.Regex("^(([A-Za-z0-9]+_+)|([A-Za-z0-9]+\-+)|([A-Za-z0-9]+\.+)|([A-Za-z0-9]+\++))*[A-Za-z0-9]+@((\w+\-+)|(\w+\.))*\w{1,63}\.[a-zA-Z]{2,6}$")
Dim M As System.Text.RegularExpressions.Match = EmailRegex.Match(email)
If M.Success Then
Return True
Else
Return False
End If
End Function
Sub SaveToDatabase()
Dim cnxn As New OleDbConnection
cnxn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & Server.MapPath("Applicants.mdb")
cnxn.Open()
Dim cmd As New OleDbCommand
cmd.Connection = cnxn
With cmd.Parameters
.Add(New OleDbParameter("@FirstName", tbFirstName.Text))
.Add(New OleDbParameter("@LastName", tbLastName.Text))
.Add(New OleDbParameter("@MiddleName", tbMiddleName.Text))
.Add(New OleDbParameter("@Social", tbSocial.Text))
.Add(New OleDbParameter("@DayPhone", tbDaytimePhone.Text))
.Add(New OleDbParameter("@EvePhone", tbEveningPhone.Text))
.Add(New OleDbParameter("@Email", tbEmail.Text))
.Add(New OleDbParameter("@Street", tbStreet.Text))
.Add(New OleDbParameter("@City", tbCity.Text))
.Add(New OleDbParameter("@State", tbState.Text))
.Add(New OleDbParameter("@Zip", tbZip.Text))
End With
If Loaded = False Then
cmd.CommandText = "INSERT INTO tblApplicants (txtFirstName, txtLastName, txtMiddleName, txtSocial, txtDaytimePhone, txtEveningPhone, txtEmail, txtStreetAddress, txtCity, txtState, txtZip)" & _
" VALUES (@FirstName, @LastName, @MiddleName, @Social, @DayPhone, @EvePhone, @Email, @Street, @City, @State, @Zip)"
Else
cmd.CommandText = "UPDATE tblApplicants SET txtFirstName=@FirstName, txtLastName=@LastName, txtMiddleName=@MiddleName, txtSocial=@Social, txtDaytimePhone=@DayPhone, " & _
"txtEveningPhone=@EvePhone, txtEmail=@Email, txtStreetAddress=@Street, txtCity=@City, txtState=@State, txtZip=@Zip WHERE pkApplicantID=" & ApplicantID
End If
cmd.ExecuteNonQuery()
'Get the pkApplicantID of the record we just inserted so we can use it for updates on all subsequent pages
cmd.CommandText = "SELECT pkApplicantID From tblApplicants ORDER BY pkApplicantID DESC"
ApplicantID = cmd.ExecuteScalar
cmd.Dispose()
cnxn.Dispose()
End Sub
End Class