Can I read ASP.Net Validator State?

narutomanga383

New Member
I got some old ASP.NET project to rework, and as this is my first touch with ASP I'm quite not understanding it.I have some digital form with some 5-6 fields of which, 4 have built in validators attached.Each validator has client side JavaScript function attached, so when I loose focus from the field it get validated, and if validation is not correct it gives red asterisk and you figure out that something is wrong. eg one function is:\[code\]function validateEmail(src, arg) { var email = document.getElementById('txtEmail_txt').value; var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/; arg.IsValid = reg.test(email); }\[/code\]Now this is all OK, but additional "functionality" is needed that when all mandatory fields are valid, "proceed" button gets enabled. I do this by binding controls with my check function in '.ascx.cs' file:\[code\]txtEmail.textbox.AutoPostBack = true;txtEmail.textbox.TextChanged += new EventHandler(requiredfields_TextChanged);chkEmailCheck.AutoPostBack = true;chkEmailCheck.CheckedChanged += new EventHandler(requiredfields_TextChanged);\[/code\]Then I set Project value to true if my requirements are correct:\[code\] void requiredfields_TextChanged(object sender, EventArgs e){ Project p = setProject(); btnSave.Enabled = EnableSubmitBtn(p);}\[/code\]And I wanted to use \[code\] private bool EnableSubmitBtn(Project p){ if (p.ProcedureType == 2) { if ('CustomValidator3 is valid' && chkEmailCheck.Checked==true){ return true; } } else { } return false;}\[/code\]Now, I'm not certain is it possible to get response from CustomValidator3 (something like CustomValidator3.isValid == true, which by the way does not work), or is the only way to rewrite JavaScript function into server side function , and then check that function ?
 
Back
Top