We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

Position of validation messages in InlineTemplateForm mode

Thread ID:

Created:

Updated:

Platform:

Replies:

117732 Dec 4,2014 01:20 PM Dec 5,2014 05:56 AM ASP.NET MVC 1
loading
Tags: Grid
Reinhard Schürer
Asked On December 4, 2014 01:20 PM

Hi

Is it possible to change the position of validation error message?

Currently the message appear below the control overlapping the control below, so I would prefer the error message on the right side of the control.

As it's based on the jquery validation I tried to change the errorElement but without success so far.

Any example how to do this?

Regards,
Reinhard

Madhu Sudhanan P [Syncfusion]
Replied On December 5, 2014 05:56 AM

Hi Reinhard,

 

Thanks for using Syncfusion products.

 

Please find the response.

 

Query: “Is it possible to change the position of validation error message?”

 

We can place the error message by overriding the errorPlacement of the jquery validate as follows. In the below code snippet, we have changed the errorPlacement of the message element in the actionComplete event. Please refer the code snippet.

 

 

@(Html.EJ().Grid<object>("ExportGrid")

            . . . . .

           .ClientSideEvents(evt=>evt.ActionComplete("setErrorElement"))

 )

 

 

function setErrorElement(args) {

            if (args.requestType == "add" || args.requestType == "beginedit") {

 

                var validate = $("#" + this._id + "EditForm").validate();

 

                validate.settings["errorPlacement"] = function (error, element) {

                    var $td = element.closest("td"), $container = $(error).addClass("e-error");

                    $td.find(".e-error").remove();

                    element.hasClass("e-numerictextbox") ? $container.insertAfter(element.closest(".e-numeric")) : $container.insertAfter(element);

                    $container.offset({ left: element.offset().left + element.outerWidth(), top: element.offset().top });

                }

 

            }

        }

 

 

 

For your convenience, we have created simple grid sample too and the same can be downloaded from the below location.

 

Sample Location: http://www.syncfusion.com/downloads/support/directtrac/general/Forum_errorMsg1024552941.zip

 

Please let us know if you have any queries.

 

Regards,

Madhu Sudhanan. P


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;