如何在 ClientTemplate 中为 Kendo MVC Grid 添加 DatePicker [英] How to add DatePicker in ClientTemplate for Kendo MVC Grid

查看:25
本文介绍了如何在 ClientTemplate 中为 Kendo MVC Grid 添加 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}");

更多详情

这篇关于如何在 ClientTemplate 中为 Kendo MVC Grid 添加 DatePicker的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆