<script runat="server">
protected void Button1_Click(object sender, EventArgs e)
{
if (PeterBlum.DES.Globals.WebFormDirector.IsValid)
{
}
}
protected void TextBox1_TextChanged(object sender, EventArgs e)
{
if (TextBox1.Text.Trim() == "firefox")
{
IgnoreConditionValidator1.IsValid = false;
IgnoreConditionValidator1.ErrorMessage = "Nice choice, but still enter 'microsoft'.";
}
else if (TextBox1.Text.Trim() != "microsoft")
IgnoreConditionValidator1.IsValid = false;
}
</script>
To see an error, enter anything except '<i>microsoft</i>'. If you enter '<i>firefox</i>', it customizes the error message.<br/>
Remember that a postback is always involved with this validator. So click Submit.<br/><br/>
<des:TextBox ID="TextBox1" runat="server" OnTextChanged="TextBox1_TextChanged"></des:TextBox>
<des:IgnoreConditionValidator ID="IgnoreConditionValidator1" runat="server"
ErrorMessage='Enter "microsoft"'
RelatedControlID="TextBox1" />
<br/><br/>
<des:Button ID="Button1" runat="server" Text="Submit" OnClick="Button1_Click" />