Hi everybody,
I'm trying to access page validators in the ASPX using the JavaScript code bellow to initially show the required validation messages:
I'm facing two problems:
1. If I'm using User Controls, the changing display of the validators doesn't seem to work (the validators' messages are not displayed).
2. In my server-side code I hide all the forms (set MultiView index to 0) once the information is properly saved. Therefore there are no Page Validators in this case. How can I adjust the above function to make sure it doesn't break?
Of course, I can add try/catch block, but I was thinking is there other ways of checking Page_Validators for existence?
Thanks in advance.
I'm trying to access page validators in the ASPX using the JavaScript code bellow to initially show the required validation messages:
Code:
function showReqFld(){
var pBlk=parent.document.getElementById('spnStat').innerHTML;
if(!pBlk||pBlk.match("Edit")) {
if (Page_Validators) {
for (i=0;i<Page_Validators.length;i++) {
if(Page_Validators[i].innerHTML.match('Required'))Page_Validators[i].style.display="block";
}
}
}
var Loading = parent.document.getElementById('loading');
if (Loading)
Loading.style.display="none";
}
I'm facing two problems:
1. If I'm using User Controls, the changing display of the validators doesn't seem to work (the validators' messages are not displayed).
2. In my server-side code I hide all the forms (set MultiView index to 0) once the information is properly saved. Therefore there are no Page Validators in this case. How can I adjust the above function to make sure it doesn't break?
Of course, I can add try/catch block, but I was thinking is there other ways of checking Page_Validators for existence?
Thanks in advance.