Visual Studio 2013 MVC
I have just begun to create an application in Visual Studio 2013 using MVC. I am trying to use jquery datapicker. I want it to show a datepicker where ever there is a DateTime field. I am creating my controllers using scaffolding (templates).
Additionally added a new bundle --
bundles.Add(new ScriptBundle("~/bundles/jqueryui").Include(
"~/Scripts/jquery-ui-{version}.js));
In the _Layout.cshtml I added 2 new Scripts.Render
@Scripts.Render("~/bundles/jqueryui")
@Scripts.Render("~/Scripts/AQB_MON.js")
I created my AQB_MON.js with the following
$(document).ready(function(){
$(".input[type='datetime']").each(function(){
$(this).datepicker();
});
})
All seems to have no affect on any datetime field. Is this due to using scaffolding to create my Controllers/Views? As I was trying to use ToShortDateString() when displaying my datetime fields and came across an issue due to having scaffolding build them.
You should use htmlhelper to display the datetime picker. Read more about html helper.
链接地址: http://www.djcxy.com/p/67986.html上一篇: 无法让JSON传递到另一个活动的意图