Ask a Question related to ASP.NET General, Design and Development.
-
George Ter-Saakov #1
CustomValidator bug?
Hi.
I am fighting the CustomValidator strange behavior for second day already.
I created some test project which is only to reproduce the problem.
1. I created UserControl which has an only a Custom Validator
2. in UserControl::Page_Load i set
CustomValidator1.IsValid = false;
3. I insert the User Control into the page and have a submit button there.
So when i run the project it shows me errors from CustomValidator (because
IsValid set to false)
But when i click submit button there is no error shown and Page.IsValid
returns true.
Am i missing something? Where should i set CustomValidator1.IsValid = false;
so the Page.IsValid would be set to false as well?
Thanks.
George.
George Ter-Saakov Guest
-
customValidator in DATAGRID
hi everyone, i' ve got a datagrid in which there is a column with an input texbox in the column "template", i've added a customvalidator an one... -
CustomValidator and XMLHTTPRequest
yes. "Anatoly" <anatolyr@gilat.com> wrote in message news:#feBwBqVDHA.2248@TK2MSFTNGP10.phx.gbl... -
CustomValidator controls
I have a User Control which has one CustomValidator control. In debug I can see that validation is failing in UserControl::Page_Load and IsValid... -
CustomValidator limitation?
I have one CustomValidator that compares 2 password fields together, and the other that checks for a contact method and its correspoding details... -
Errormessage in CustomValidator
Hi, I´m using a server function in a CustomValidator control to verify a field date content before an insert process. What should I do to avoid... -
Hans Kesting #2
Re: CustomValidator bug?
"George Ter-Saakov" <we@hotmail.com> wrote in message
news:ugr99JFUDHA.1552@TK2MSFTNGP10.phx.gbl...false;> Hi.
>
> I am fighting the CustomValidator strange behavior for second day already.
> I created some test project which is only to reproduce the problem.
>
> 1. I created UserControl which has an only a Custom Validator
> 2. in UserControl::Page_Load i set
> CustomValidator1.IsValid = false;
>
> 3. I insert the User Control into the page and have a submit button there.
>
>
> So when i run the project it shows me errors from CustomValidator (because
> IsValid set to false)
> But when i click submit button there is no error shown and Page.IsValid
> returns true.
>
>
> Am i missing something? Where should i set CustomValidator1.IsValid =To implement a CustomValidator you need to handle the ServerValidate event.> so the Page.IsValid would be set to false as well?
>
>
> Thanks.
> George.
>
>
private void CustomValidator1_ServerValidate(object source,
System.Web.UI.WebControls.ServerValidateEventArgs args)
{
args.IsValid = false;
}
Hans Kesting
Hans Kesting Guest
-
George Ter-Saakov #3
Re: CustomValidator bug?
Got to the bottom of it.
It turned out that I must provide handler CustomValidator.ServerValidate and
set args.IsValid = false in it.
Otherwise the IsValid is reset to true.
Which is not very good design. I would say if ServerValidate event is not
handled then IsValid must stay as is.
Thanks.
George.
"George Ter-Saakov" <we@hotmail.com> wrote in message
news:ugr99JFUDHA.1552@TK2MSFTNGP10.phx.gbl...false;> Hi.
>
> I am fighting the CustomValidator strange behavior for second day already.
> I created some test project which is only to reproduce the problem.
>
> 1. I created UserControl which has an only a Custom Validator
> 2. in UserControl::Page_Load i set
> CustomValidator1.IsValid = false;
>
> 3. I insert the User Control into the page and have a submit button there.
>
>
> So when i run the project it shows me errors from CustomValidator (because
> IsValid set to false)
> But when i click submit button there is no error shown and Page.IsValid
> returns true.
>
>
> Am i missing something? Where should i set CustomValidator1.IsValid => so the Page.IsValid would be set to false as well?
>
>
> Thanks.
> George.
>
>
George Ter-Saakov Guest



Reply With Quote

