This is a migrated thread and some comments may be shown as answers.

How to change default validation message in kendo grid ?

3 Answers 819 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Rajasakthi
Top achievements
Rank 1
Rajasakthi asked on 02 Jan 2014, 12:44 PM
 I am using date column in grid  while in-line edit if I enter invalid date ( like "ewr") then it showing default validation message "Filedname is not valid date". But Instead of default message I need to show custom message.  How can I change the  message?

3 Answers, 1 is accepted

Sort by
0
Nikolay Rusev
Telerik team
answered on 03 Jan 2014, 08:44 AM
Hello Rajasakthi,

You can add custom validation message to your field definition in the model. Here is the relevant code for this:
..
 schema: {
  model: {
   id: "ProductID",
   fields: {
    fakeDate: {
       type:
"date",
     validation: {
      date: {
       message: "My Custom Message"
      }
     }
    },
 //...other field definitions
}


Here is also a runnable example: http://jsbin.com/aRodOdUH/1/edit

Regards,
Nikolay Rusev
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Rajasakthi
Top achievements
Rank 1
answered on 03 Jan 2014, 08:56 AM
Its a MVC application. I am using MVC model as datasource
0
Nikolay Rusev
Telerik team
answered on 03 Jan 2014, 09:53 AM
Hello Rajasakthi,

When using ASP.NET MVC the messages are controlled by the framework. Most of them can be change by using data annotations. However in order to change the default message for invalid date you will need to create a resource file. The following articles explains how to accomplish this:
 - Customizing FieldMustBeDate
 - http://stackoverflow.com/a/18392437/1393172
 - Localizing Default Error Messages in ASP.NET MVC

Regards,
Nikolay Rusev
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
Grid
Asked by
Rajasakthi
Top achievements
Rank 1
Answers by
Nikolay Rusev
Telerik team
Rajasakthi
Top achievements
Rank 1
Share this question
or