PAGE_CLIENTVALIDATE IN UNDEFINED

Ankita Pandey

Total Post:183

Points:1285
Posted by  Ankita Pandey
C# 
 1497  View(s)
Ratings:
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

  1. Samuel Fernandes

    Post:159

    Points:1117
    Re: Page_ClientValidate in undefined

    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');

            }

        }

    });

     

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!