How to add DatePicker to ClientTemplate for Kendo MVC Grid

I am trying to pipe my code from syncfusion to telerik kendo MVC UI, I need to show Datepicker in a Grid cell and for which I did in a grid column as:

columns.Add("TemplateCol").Title("Out of date").TemplateColumn(true).TemplateName("TemplateOutOfDate");

      

and for TemplateOutOfDate I did in a separate .cshtml file like

@Html.Syncfusion().DatePicker("OutOfDate" + Model.ID.ToString(), Model.OutOfDate).DefaultDate(Model.OutOfDate).DisplayDefaultDateOnLoad(true).DateFormat(Model.DefaultDateFormat).Width(75).OnSelect("onselect")

      

This one .cshtml

works fine in Syncfusion grid, but when I migrate this code to Kendo().Grid

it doesn't work So please tell me we can achieve this using ClientTemplate to add DatePicker to Kendo grid.

Thank you, Agit

+3


source to share


1 answer


try it

columns.Bound(c => c.BirthDate).HtmlAttributes(new
    {
        @class = "templateCell"

    }).ClientTemplate(
     Html.Kendo().DatePicker()
      .Name("FDPicker_#=ID#")
      .Format("{0:dd/MM/yyyy}")
      .HtmlAttributes(new { data_bind = "value:BirthDate" })
      .ToClientTemplate().ToString()
      ).Format("{0:dd/MM/yyyy}");

      



More details

+4


source







All Articles