CustomValidation

  • Thread starter Thread starter SAI
  • Start date Start date
S

SAI

Should I bind one of the controls to the CustomValidation Object? e.g. bind
text box to it. In some cases, I may need to check 2 web object contents.
How to do it in one CustomValidation Object?

I tried to bind a text box to CustomValidation Object and set the Client
Validation to TRUE. Then I write a javascript to validate. It is no any
action about the checking. Any suggestion? thanks.
 
You don't bind controls to validators...if you mean use the
"ControlToValidate" you can leave it blank in the case of custom
validator....in custom validator on the client side, you need to get a
reference to the control yourself:

function Validate(src, args)
{
var txt = document.getElementById("myTextbox");
if (txt.value == "")
{
args.IsValid = false;
}
}

--
MY ASP.Net tutorials
http://www.openmymind.net/ - New and Improved (yes, the popup is
annoying)
http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
come!)
 
Back
Top