Data Validation on Kendo Grid with Editor Template on Date field

2 posts, 1 answers
  1. Gomathy
    Gomathy avatar
    1 posts
    Member since:
    Apr 2014

    Posted 28 Oct 2015 Link to this post


    I'm having some problems with data validation with the kendo grid. I've set up the Grid to use a model that has several fields. I'm most interested in the DateTime field for which I've set up data annotations to help with validation. I've labeled the field to be Required, to use a regular RegularExpression, and I've also specified an EditorTemplate called "BeginDateEditor". The editing mode is set up to be InLine. The problem occurs when I actually try to edit the field. The data validation doesn't seem to work. The editing will allow the user to close the cell with no value where in fact it should notify the user that there is a problem and keep the cell open for editing. I've attached a sample project to illustrate the problem. 

    Thank you.

  2. Answer
    Rosen avatar
    3215 posts

    Posted 30 Oct 2015 Link to this post

    Hello Gomathy,

    The issue you have described is caused by incorrect configuration of the EditorTemplate. You should instead use DataPickerFor extension method. This way the metadata associated with property will be retrieved and applied to  widget declaration. 

    @using Kendo.Mvc.UI
    @model DateTime
    @(Html.Kendo().DatePickerFor(m => m)

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  3. UI for ASP.NET AJAX banner
Back to Top