显示日期时间选择器,而不是日期选择器在ASP .NET MVC 5.1 / HTML 5的具体 [英] Displaying DateTime picker instead of Date picker in ASP .NET MVC 5.1/HTML 5 specific

查看:473
本文介绍了显示日期时间选择器,而不是日期选择器在ASP .NET MVC 5.1 / HTML 5的具体的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的ASP.NET MVC应用程序编写5.1

I write application in ASP .NET MVC 5.1

我有一个字段:

  [DisplayName("Date of Birth")]
  [DataType(DataType.Date)]
  public DateTime BirthDate { get; set; }



,然后在视图

and then in View

  <div class="form-group">
            @Html.LabelFor(model => model.BirthDate, htmlAttributes: new { @class = "control-label col-md-2" })
            <div class="col-md-10">
                @Html.EditorFor(model => model.BirthDate, new { htmlAttributes = new { @class = "form-control" } })
                @Html.ValidationMessageFor(model => model.BirthDate, "", new { @class = "text-danger" })
            </div>
        </div>



翻译过来就是:

which translates to:

如果我只是改变上述财产annotiations在模型:

if I just change annotiations above property in model to:

    [DisplayName("Date of Birth")]
    [DataType(DataType.DateTime)]

我没有得到任何选择器中显示。如果我将其更改为:

I don't get any picker displayed. If I change them to:

 [DisplayName("Date of Birth")]
 [DataType(DataType.Time)]

只有HH:mm处选择

问:显示日期时间选择器代替ASP .NET MVC 5.1日期选择器。我要求ASP .NET 5.1的HTML 5的具体解决方案。

Question: Displaying DateTime picker instead of Date picker in ASP .NET MVC 5.1. I am asking for ASP .NET 5.1 HTML 5 specific solution.

推荐答案

您收到此日期选取器,因为HTML5和浏览器支持HTML5。
可能的选项:

You are getting this date picker because of html5 and browser supporting html5. Possible options :

  • BootStrap datetime picker
  • jQuery Datetime Picker

这篇关于显示日期时间选择器,而不是日期选择器在ASP .NET MVC 5.1 / HTML 5的具体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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