I created a sample dropdown containing states and it worked fine for me.
The only difference is I didn't use the Page.IsValid
Here's the code (server):
private void CustomValidator1_ServerValidate_1(object source,
System.Web.UI.WebControls.ServerValidateEventArgs args)
{
string s = args.Value;
if (s == "IL")
{
args.IsValid = true;
}
else
{
args.IsValid = false;
}
}
Steve
-----Original Message-----
From: Ted Haber [mailto:tedhaber@s...]
Sent: Wednesday, December 12, 2001 5:23 AM
To: ASPX_Professional
Subject: [aspx_professional] Re: Problems with CustomValidation Control
Hey Rick:
I am working on a project where I am experiencing the same exact problem.
For test purposes I don't fill any form fields - including the text
boxes. All the RequiredValidation controls fire for the missing values in
the textboxes and my CustomValidation controls fire (using my work-around
code on the Server and the client.) When I add values to the textboxes,
the error message disappears when I tab from that field (IE60) but like
you I can no longer clear the CustomValidation error msgs from my
dropdownlists. Looks like a bug to me. I am using Beta 2 (1_0_2914_16).
If you hear anything please let me know. I will do the same.
You would think that this should be an easy thing to do!
Ted
> I need to validate whether or not an item was selected in a
dropdownlist. I
> don't think any of the validation controls can do this directly, so I am
> trying to use the CustomValidation Control to in order to be able to
write
> my own code for this particular validation. However, when going through
the
> routine on the server and setting the IsValid = false, the page continues
> submitting beyond the Page.IsValid as though it is valid even though I
just
> attempted to tell it that it is not valid. I experience the same
problems
> having the validation code run on the client.
>
> Any suggestion welcome.
>
> Thanks.
> Rick.
>
>
$subst('Email.Unsub').