Home > DeveloperSection > Forums > Page_ClientValidate in undefined
Ankita Pandey
Ankita Pandey

Total Post:183

Points:1285
Posted on    January-07-2015 10:22 PM

 ASP.Net C# 
Ratings:


 1 Reply(s)
 777  View(s)
Rate this:

I have an asp.net user control which is plugged into both asp.net and MVC pages

When the control is on an asp.net page the client validation in it works fine but when the control is on an MVC page the following call in the js validation fails;

Page_ClientValidate('ValidationGroup');

with the error in Chrome: Object [object global] has no method 'Page_ClientValidate'

How can I get my client side validation to work on my mvc pages when the hyperlink button is clicked?

I need whatever the solution is to work across both MVC and ASP.Net as our site is a combination of the two



Samuel Fernandes
Samuel Fernandes

Total Post:154

Points:1082
Posted on    January-08-2015 2:50 AM

Try something like this,

$('#Form').submit(function () {

    if (typeof (Page_ClientValidate) == 'function') {

        Page_ClientValidate();

        if (Page_IsValid == true) {

            alert('the form is valid');

        }

    } else {

        if ($(this).valid()) {

            alert('the form is valid');

        }

    }

});

 


Don't want to miss updates? Please click the below button!

Follow MindStick