Javascript and .Net Validation controls...

  • Thread starter Thread starter Roh
  • Start date Start date
R

Roh

Hi,

Can we use Javascript and .Net Validation controls on the same page. If yes how?
Please provide some examples which will help me a lot....thanks.
 
Sure you can.
No problems.

Do you want to validate the same control with both your own javascript and
the .net Validation control ?
You can just call up your own javascript validation when clicking on a
button etc.
Then if everything is fine there i guess you can do a form.submit() and pass
control to .Net validation controls that always validate just before the
postback and halts the postback if validation is not ok.

Best regards Thue Tuxen
 
<script language="javascript">
function ConfirmDelete()
{
return confirm("Are you sure you want to delete this?");
}
</script>

in code behind:
btn.Attributes.Add("OnClick", "return ConfirmDelete();");

Also you may use this in js function:

if (!Page_ClientValidate ())
return;
if the validators don't pass the check, the function stops executing.

Hope that helps!
Regards,
Kostadin Kostov


You may use this code. If you click OK on the confirm window that pops up,
then the validator controls will be checked if valid and if so, the form will
be submitted by the Button btn.
 
Back
Top