Javascript and .Net Validation controls...

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.
 
T

Thue Sørensen

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
 
G

Guest

<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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top