如何在KenTemplate MVC网格的ClientTemplate中添加DatePicker [英] How to add DatePicker in ClientTemplate for Kendo MVC Grid
本文介绍了如何在KenTemplate MVC网格的ClientTemplate中添加DatePicker的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试将代码从syncfusion移植到telerik kendo MVC UI, 我需要在网格"单元中显示Datepicker,为此我在网格"列中显示为:
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");
,对于TemplateOutOfDate,我在单独的.cshtml文件中输入为
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")
此.cshtml
在Syncfusion网格中正常工作,但是当我将此代码移植到Kendo().Grid
时,它不起作用
因此,请告诉我,我们可以使用ClientTemplate在Kendo Grid中添加DatePicker来实现.
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.
谢谢阿吉特
推荐答案
尝试一下
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}");