By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,081 Members | 2,118 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,081 IT Pros & Developers. It's quick & easy.

How to get the list of validators for a control.

P: n/a
Raj

Is it possible to get the list of all the validators that are attached to a
control ( for example Textbox) using client side javascript.

Thanks.

Nov 18 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Yes, client-side validators are acutally <span tags so you should be able to
do something like:

var spans = document.getElementsByTagName("span");
for (var i = 0; i < spans.length; ++i){
var span = spans[i];
var controlToValidate = span.exclude ||
span.getAttribute('controltovalidate');
if (controlToValidate != null && controlToValidate ==
'<%=TEXTBOXNAME.ClientId%>'){
alert(span);
}
}

span will them be a DOM object which points to a valiadator for TEXTBOXNAME
Karl
--
MY ASP.Net tutorials
http://www.openmymind.net/
"Raj" <Ra*@discussions.microsoft.com> wrote in message
news:1E**********************************@microsof t.com...

Is it possible to get the list of all the validators that are attached to a control ( for example Textbox) using client side javascript.

Thanks.

Nov 18 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.