Page_ClientValidate in undefined

Total Post:183

Points:1285

C# 
 2170  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. 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');
            }
        }
    });

     

      Modified On Apr-07-2018 06:38:46 AM

Answer

Please check, If you want to make this post sponsored

You are not a Sponsored Member. Click Here to Subscribe the Membership.