Thursday, February 17, 2011

Disable an ASP.NET validation from Javascript

Below is a small code i used to disable my dotnet validators through javascript
var myVal = document.getElementById('MyvalidatorsClientId');
ValidatorEnable(myVal, false);

where ValidatorEnable(Object, Enabled).

A sample could be
function CountryChanged()
{
var myVal = document.getElementById('ctl00_ContentPlaceHolder1_RfvtxtState');
ValidatorEnable(myVal, false);
}

3 comments:

  1. Another great article. I like that you are very honest and direct to the point.

    ReplyDelete
  2. This is truly a great read for me. I have bookmarked it and I am looking forward to reading new articles. Keep up the good work

    ReplyDelete
  3. I found this article truly insightful. I've bookmarked it and eagerly anticipate reading more of your work. Keep up the excellent work!

    ReplyDelete