BaseValidator Custom Validator validating on a Repeater

G

Guest

Hi All,

I have a repeater that required a check box on each item in the repeater to
be validated against eachother (to check if only one item's checkbox is
ticked.) To perform this validation I created a validation control that
inherits from BaseValidator and performs server and client side checks and is
performing the validation on the repeater control.

The above all works except I cant get the client validation to stop the page
from submitting - it does not call the validation function for the control.

I have added code such as:

AddAttributesToRender { ...

writer.AddAttribute("evaluationfunction", "CheckAllCheckBoxes" +
this.ClientID);

....
}

or

RegisterValidatorDeclaration {

...

string element = "document.getElementById(\"" + this.ClientID + "\")";
Page.RegisterArrayDeclaration("Page_Validators", element);
...

}

Neither seem to enable the client script to be run when the submit button is
pressed.

Please help
 
G

Guest

UPDATE:

OK, I have added both the code below and can see the validation occuring
when I click submit on the form. The reason it's not validating now is that
val.enabled in the asp.net javascript validation always returns false (where
val is the validation control.) I have done Enabled=true in the aspx and also
tried addAttribute("enabled","true") - neither work - it always comes up with
val.enabled = false.

Any other ideas?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,982
Messages
2,570,186
Members
46,743
Latest member
WoodrowMea

Latest Threads

Top