使用asp.net MVC包装在剑道UI网格格式的DateTime [英] Format DateTime in Kendo UI Grid using asp.net MVC Wrapper

查看:277
本文介绍了使用asp.net MVC包装在剑道UI网格格式的DateTime的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想建立一个剑道UI电网与格式日期DD // MM / YYYY。然而,我发现这一切的问题,它用code 格式解决({0:D}); 。所以,我试图像低于code:

I want to build a Kendo UI Grid with format date dd//MM/yyyy. However, all questions that I found about this, it were resolved with code Format("{0:d}");. So, I have tried like a code below:

GridBoundColumnBuilder<TModel> builder = par.Bound(field.Name);

        switch (field.Type.Type)
        {
            case CType.Boolean:
                builder = builder.ClientTemplate(string.Format("<input type='checkbox' #= {0} ? checked='checked' : '' # disabled='disabled' ></input>", field.Name));
                break;
            case CType.Datetime:
                builder = builder.Format("{0:d}");
                break;
            case CType.Decimal:
            case CType.Double:
                builder = builder.Format("{0:0.00}");
                break;
        }

另外一个格式是做工精细,只是日期时间不工作。

Another formats is works fine, just DateTime do not works.

我有这样的结果对于日期时间= /日期(1377020142000)/

I had this result for Datetime = /Date(1377020142000)/

推荐答案

如果你想显示在剑道电网日期时间格式,然后为此,

If you want to display datetime format in kendo grid then do this,

.Format("{0:dd/MM/yyyy}") 

或者

builder.ToString("dd/MM/yyyy");

这篇关于使用asp.net MVC包装在剑道UI网格格式的DateTime的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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