KendoUI DatePicker Set Value culture dd/MM/yyyy only works fine es-AR and not es-CL

2.5k views Asked by At

I have a issue and lost 3 days... I using the Globalization in Kendo UI.

  • I have read several times http://docs.telerik.com/kendo-ui/aspnet-mvc/globalization and apply in my web proyect.

  • I use ASP.NET MVC. Framework 4. Visual Studio 2010. Kendo UI 2014.2.1008

  • My country is Chile. I should be use es-CL for culture and es-ES for UICulture (spanish messages for pageable, filterable, etc).

  • I need that my whole app works as dd/MM/yyyy independent of client PC Windows culture is set.

  • I set the kendo.culture.es-CL.min.js as a copy of kendo.culture.es-AR.min.js, It was a copy & paste, it was the only thing I could think to do :(

  • I have a Partial View in header with the load of culture and others, it load first other views:

@{

var culture =  System.Globalization.CultureInfo.CurrentCulture.ToString();  //se obtiene del servidor (web.config)
var cultureUI = System.Globalization.CultureInfo.CurrentUICulture.ToString();  //textos de mensajes kendo, paginaciĆ³n, filtros, etc, se obtiene del servidor (web.config)
}
<script src="@Url.Content("~/Scripts/kendo/2014.2.1008/messages/kendo.messages." + cultureUI + ".min.js")"></script>

<script>
kendo.culture("@culture");
</script>
  • I have a controller HomeController a Test Action:

    public ActionResult Test(DateTime fechaTermino)
    {
      ViewBag.FechaTermino = fechaTermino;
      return View();
    }
    
  • Then, I have a View "Test" (after load the previus View), I set my DatePicker:

    @{ var fechaTermino = (DateTime)ViewBag.FechaTermino; }

    ...

    @(Html.Kendo().DatePicker() .Name("mdpTermino")
    .Value(fechaTermino)
    )

  • I set the culture in my web.config to es-CL and not works! (see picture, appear dd-MM-yyyy)

    < globalization uiCulture="es-ES" culture="es-CL" / >

  • I change the culture to es-AR and its works!! (appear dd/MM/yyyy) why? I have both js files in my Kendo folder in my solution.

    < globalization uiCulture="es-ES" culture="es-AR" / >

  • I Try put format in every DatePiker how see in this example use HTML 5 /JS (I use MVC mode):

http://dojo.telerik.com/UqON

It's is very slowly, I don't like change 20 DatePikers everytime, and I put in my DatePiker:

.Format("dd/MM/yyyy") 

and don't work using es-CL. It continue showing dd-MM-yyyy, ignores the format!!

Why only that es-AR works and not es-CL? Error In set es-CL culture KendoUI, only works es-AR for dd/MM/yyyy

0

There are 0 answers