日期:2009-08-31  浏览次数:20985 次

<%@ Page Language="VB" ClientTarget="downlevel" %>

<%@ Import Namespace="System.Text" %>

<script language="VB" runat="server">
Const strCheckMarkHTML As String = "<img src=../../""./images/check.gif"" border=""0"" width=""25""
height=""25"" />"

Sub Page_Load(Src as object, E as EventArgs)
lblStatus.Visible = False

validName.ErrorMessage          = strCheckMarkHTML
validEmailRequired.ErrorMessage = strCheckMarkHTML
validEmailRegExp.ErrorMessage   = strCheckMarkHTML
validAddress.ErrorMessage       = strCheckMarkHTML
validCity.ErrorMessage          = strCheckMarkHTML
validStateRequired.ErrorMessage = strCheckMarkHTML
validStateRegExp.ErrorMessage   = strCheckMarkHTML
validZipRequired.ErrorMessage   = strCheckMarkHTML
validZipRegExp.ErrorMessage     = strCheckMarkHTML
End Sub

Sub btnReset_OnClick(Sender As Object, E As EventArgs)
lblStatus.Visible = False

txtName.Text    = ""
txtEmail.Text   = ""
txtAddress.Text = ""
txtCity.Text    = ""
txtState.Text   = ""
txtZip.Text     = ""
End Sub

Sub btnSubmit_OnClick(Sender As Object, E As EventArgs)
Dim strLabelText As StringBuilder = new StringBuilder()

If Page.IsValid Then
divFormSection.Visible = False

strLabelText.Append("Your entry meets our validation criteria!")
strLabelText.Append("<br /><br />")
strLabelText.Append("This would naturally be the point where ")
strLabelText.Append("you just entered data would be getting ")
strLabelText.Append("logged to a file, inserted into a database, ")
strLabelText.Append("mailed off to someone, or whatever your ")
strLabelText.Append("plans for it might happen to be!  Since ")
strLabelText.Append("we're just playing with the form here, I ")
strLabelText.Append("simply show it below.<br /><br />")
strLabelText.Append("<b>Here's what you entered:</b><br />")

strLabelText.Append("Name: " & txtName.Text & "<br />" & vbCrLf)
strLabelText.Append("Email: " & txtEm