How to add DatePicker in ClientTemplate for Kendo MVC Grid

≯℡__Kan透↙ 提交于 2019-12-10 10:14:09

问题


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

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

and for TemplateOutOfDate I have made in seperate .cshtml file as

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

This .cshtml work fine in Syncfusion grid but when I port this code to Kendo().Grid it is not working So please tell me on we can achieve this using ClientTemplate to add DatePicker in Kendo Grid.

Thanks,Ajit


回答1:


Try this

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



来源:https://stackoverflow.com/questions/25643939/how-to-add-datepicker-in-clienttemplate-for-kendo-mvc-grid

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!