📄 customvalidator.aspx
字号:
<Script Runat="Server">
Sub Button_Click( s As Object, e As EventArgs )
If IsValid Then
Response.Redirect( "ThankYou.aspx" )
End If
End Sub
Sub CustomValidator_ServerValidate( s As Object, e As ServerValidateEventArgs )
Dim strValue As String
strValue = e.Value.ToUpper()
If strValue.IndexOf( "ASP.NET UNLEASHED" ) > -1 Then
e.IsValid = True
Else
e.IsValid = False
End If
End Sub
</script>
<html>
<head>
<Script Language="VBScript">
Sub CustomValidator_ClientValidate( s, e )
Dim strValue
strValue = UCase( e.Value )
If Instr( strValue, "ASP.NET UNLEASHED" ) > 0 Then
e.IsValid = True
Else
e.IsValid = False
End If
End Sub
</Script>
<title>CustomValidator.aspx</title>
</head>
<body>
<form Runat="Server">
Enter the name of your favorite book:
<br>
<asp:CustomValidator
ControlToValidate="txtFavBook"
ClientValidationFunction="CustomValidator_ClientValidate"
OnServerValidate="CustomValidator_ServerValidate"
Display="Dynamic"
Text="You must type ASP.NET Unleashed!"
Runat="Server" />
<br>
<asp:TextBox
ID="txtFavBook"
TextMode="Multiline"
Columns="50"
Rows="3"
Runat="Server" />
<p>
<asp:Button
Text="Submit!"
OnClick="Button_Click"
Runat="Server" />
</form>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -