使用jquery-picker插件作为datetime属性的编辑器模板



我发现了一个有趣的jquery datetime插件,我想将它设置为asp.net mvc 5应用程序中所有datetime属性的编辑器模板。

我知道我应该把一些代码放在Shared/EditorTemplate中,但我没有更多。

查看

@Html.TextboxFor(m => m.PROPERTY, new{ data_field="date",@readonly="readonly"}
<div id="dtBox"></div>
@section scripts{
 @Scripts.Render("~/bundles/jquerydatetimeplugin") // this is obviously managed in BundleConfig.cs
 $(function()
  {
    $("#dtBox").DateTimePicker();
  });
 }

Layout.cshtml

....
  @Scripts.Render("~/bundles/jquery")
  @RenderSection("scripts", required: false)
</body>
</html>

相关内容

最新更新