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

Client-side validation failed

1 Answer 147 Views
Date/Time Pickers
This is a migrated thread and some comments may be shown as answers.
Ivan
Top achievements
Rank 1
Ivan asked on 14 Mar 2013, 11:31 PM
Hi!
I have problem with client-side validation.  Even after I set Culture and it shows proper date format, when I submit page client-side validation fires error "The field Datum očitavanja must be a date.". Here is my code in view:

@model ISPIS.Models.TerenskiRezultatFK
 
@section headCultureContent {
    <script src="@Url.Content("~/Scripts/kendo.culture.sr-Latn-RS.min.js")"></script>
}
  
<script type="text/javascript">
    //set culture of the Kendo UI
    kendo.culture("sr-Latn-RS");
</script>
  
 
@{
    ViewBag.Title = "Create";
    Culture = "sr-Latn-RS";
}
<div class="editor-label">
    @Html.LabelFor(model => model.DatumOcitavanja)
</div>
<div class="editor-field">
 
    @(Html.Kendo().DateTimePicker()
    .Name("DatumOcitavanja")
    .Value(DateTime.Now)
    /*.Culture("sr-Latn-RS")*/
    .Format("dd.MM.yyyy HH:mm")
    .HtmlAttributes(new { style = "width:220px" })
    )
 
    @Html.ValidationMessageFor(model => model.DatumOcitavanja)
</div>
Please for some instruction. Thanks!

1 Answer, 1 is accepted

Sort by
0
Vladimir Iliev
Telerik team
answered on 18 Mar 2013, 03:43 PM
Hi Ivan,

 
Most probably the server and the client cultures are different resulting in different formats for the validation and the dateTimePicker. Could you please provide runable project where the issue is reproduced - this would help us pinpoint the exact reason for this behavior. 

Also I would suggest to check the "Grid Globalization" demo in the offline demos which comes with your KendoUI for ASP.NET MVC installation. 

Kind Regards,
Vladimir Iliev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
Date/Time Pickers
Asked by
Ivan
Top achievements
Rank 1
Answers by
Vladimir Iliev
Telerik team
Share this question
or