<script runat=server language =c#>void Button_Click(object s,EventArgs e)
{
if (IsValid)
Response.Redirect("ThankYou.aspx");
}void CustomValidator_ServerValidate(object s,ServerValidateEventArgs e)
{
string strValue; strValue = e.Value.ToUpper();
if (strValue.IndexOf("ASP.NET UNLEASHED") > -1 )
e.IsValid = true;
else
e.IsValid = false;
}</script><html>
<head><script language="javascript">
function CustomValidator_ClientValidate(s,e)
{
var strValue;
strValue = e.Value; if (strValue.indexOf( "ASP.NET UNLEASHED" ) > -1 )
e.IsValid = true;
else
e.IsValid = false;
}</script><title>CustomValidator.aspx</title>
</head>
<body><form id="form1" runat=server>Enter the name of your favorite book:
<br>
<asp:CustomValidator
id="customValid"
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 ID="Button1"/></form>
</body>
</html>