472,131 Members | 1,403 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,131 software developers and data experts.

Custom Validation Summary Problem

kpg
I can't get the CustomValidator (CV) ErrorMessage to display
in the ValidationSummary.

On the same page I have several RequiredField Validators
and a Range Validator, that all work just fine, that is,
the ErrorMessage text is displayed by the Validation summary
control.

If I leave the CV Text field blank then the errormmessage
does display on the CV itself.

According to the MSDN help, the Validation summary control
should display the messages of all validator controls
on the page.

Is this a bug or am I doing something wrong?

kpg
Dec 15 '06 #1
4 6806
the validation summary only updates its display when a submit is attempted.

-- bruce (sqlwork.com)

kpg wrote:
I can't get the CustomValidator (CV) ErrorMessage to display
in the ValidationSummary.

On the same page I have several RequiredField Validators
and a Range Validator, that all work just fine, that is,
the ErrorMessage text is displayed by the Validation summary
control.

If I leave the CV Text field blank then the errormmessage
does display on the CV itself.

According to the MSDN help, the Validation summary control
should display the messages of all validator controls
on the page.

Is this a bug or am I doing something wrong?

kpg
Dec 15 '06 #2
kpg
bruce barker <no****@nospam.comwrote in
news:ew**************@TK2MSFTNGP06.phx.gbl:
the validation summary only updates its display when a submit is
attempted.
I have a submit button with validation set to true, when
clicked, the other vaidation control's error messages are
displayed in the validation control. Everything is set up
properly, but the custom validator's errormessage does not
display in the validation summary message box.

kpg
Dec 15 '06 #3
There are several things you need to ensure to have a customValidator
work.

1) The customValidator has to appear in the same container as the field
being validated

2) Even if you aren't using client-side validation, you still have to
specify an empty error checking function in the JScript of the HTML
page on which the validator resides. And, this "dummy" function has to
return true for its args (make sure you specify the name of this
function in the property list for the validator)

function customvalidator(source,args){
args.IsValid=true;
}

3) In the server-side custom validation code, you have to set three
properties on your validator if the check failed for the message to
appear in the summary control, and your server-side custom validation
code has to return false for edit failures:
private function yourCustomCheckingRoutine()
System.Boolean blnResult=true;

if(yourTest)
{
blnResult=false;
cvYourValidator.ErrorMessage="Your error message";
cvYourValidator.Text="*";
cvYourValidator.IsValid=false;
}

return(blnResult);
}

Dec 15 '06 #4
kpg
"Andy" <an****@infotek-consulting.comwrote in
news:11**********************@l12g2000cwl.googlegr oups.com:
2) Even if you aren't using client-side validation, you still have to
specify an empty error checking function in the JScript of the HTML
page on which the validator resides. And, this "dummy" function has to
return true for its args (make sure you specify the name of this
function in the property list for the validator)

This was it. Once I added the dummy function it worked.

This must be a bug, the documentation says the client side script
is optional.

Thanks
kpg
Dec 15 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Mike Moore | last post: by
2 posts views Thread by nmakhan | last post: by
1 post views Thread by daveh551 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.