Ticket Q462474
Visible to All Users
Duplicate

We have closed this ticket because another page addresses its subject:

Support unobtrusive validation for the GridView's built-in edit form

MVC GridView - Client validation in default EditForm

created 11 years ago (modified 11 years ago)

[DevExpress Support Team: This issue was cloned from MVC GridView - EditForm]
Hello,
I like the ASP.NET MVC GridView very much. One of its biggest advantages for me is the ability to automatically create an insert and an edit form and tune it with EditForm properties. This feature speeds the development very much, because I usually do not need to develop GUI for these. This is really awesome! Only when necessary I set a template (which is another great feature of your product). Really very good job! :-)

I have some troubles however. I've been playing with GridView for a few days only so far, so please just correct me if I'm wrong. Here are my problems ordered by importance. I do not create separate tickets, as this is only feedback, not request for help, and the problems all relate to EditForm.

1. Client side validation
Client side validation is for me very important. I've been searching the documentation and googling but failed to create a working example without coding GUI for insert / update in partial views. I found this ticket, but it's quit old. Solution points to an example beginning with "Create an Edit Form template that contains a form and all necessary editors." This kills the above mentioned advantage of the product. I would really appreciate if the only thing necessary for client side validation in GridView was decorating the model class with validation attributes.

<bold>

Answers approved by DevExpress Support

created 11 years ago (modified 11 years ago)

Hello Petr,
You can use client-side validation with the default Edit Form in the GridView. For example, you can use the Unobtrusive Client Validation approach. Refer to the How to correctly enable Model, Unobtrusive or jQuery Client validation article to learn how to enable unobtrusive validation in MVC project.
Updated:
I apologize for the mistake - unobtrusive validation is not available in the default Edit Form at this moment and can be used only for the template Edit Form. We are considering implementing this feature in the future: GridView - How to enable the client-side validation in the Edit Form.
In the meantime, I suggest you use built-in validation instead:GridView - How to use Microsoft validation with an AJAX form to validate the Model properties on the client side.

    Show previous comments (7)
    DevExpress Support Team 11 years ago

      Hello Petr,

      The cause of the problem is that client validation scripts are embedded via embedRequiredClientLibraries: T121218: Data Editors - Unobtrusive JavaScript validation does not work for dynamically loaded forms. We have fixed this issue in the next minor version, so you can either wait for a hotfix, or include validation scripts manually.

        Hi there!
        Is there any changes? I have the same problem with gridview using 14.2.7. Moreover EditForm template with FormLayout shows the same behaviour: validation occurs only on server-side. Although if I place the same FormLayout to the same page as a separate form it works just fine. Maybe there should be something to call on button click to validate on client-side? How is it supposed to work? Should I additionally wrap the table or template with the form?

        DevExpress Support Team 10 years ago

          Hello Alexander,

          To process your recent post more efficiently, I created a separate ticket on your behalf: T247829: MVC GridView - Client validation does not work in default EditForm. This ticket is currently in our processing queue. Our team will address it as soon as we have any updates.

          Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

          Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.