Example:
Javascript code:
function fnOnUpdateValidators() {
var flag = true;
for (var i = 0; i < Page_Validators.length; i++) {
var val = Page_Validators[i];
var ctrl = document.getElementById(val.controltovalidate);
if (ctrl != null) {
if (!val.isvalid) {
flag = false;
}
}
}
if(flag==false)
document.getElementById("masterPageLabel").visible = true;
else
document.getElementById("masterPageLabel").visible = false;
}
C# code
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
Page.ClientScript.RegisterOnSubmitStatement(this.GetType(), "val", "fnOnUpdateValidators();");
}