我很难解决这个问题(我确信我在某处犯了一些愚蠢的错误:))有人可以帮忙.
在提交时,我无法在模型中检索使用JQuery datepicker选择的日期.它给我价值'1/1/0001 12:00:00 AM'.我错过了什么吗?
为了解决我的问题,我使用Visual Studio 2010中的模板创建了一个简单的MVC3应用程序.详情如下:
模型:
namespace DatePickerApp.Models
{
public class DatePickerClass
{
public DateTime BirthDate { get; set; }
}
}
Run Code Online (Sandbox Code Playgroud)
控制器:
namespace DatePickerApp.Controllers
{
public class BirthDateController : Controller
{
//
// GET: /BirthDate/Create
public ActionResult Create()
{
return View();
}
//
// POST: /BirthDate/Create
[HttpPost]
public ActionResult Create(DatePickerApp.Models.DatePickerClass DatePickerClass)
{
try
{
// TODO: Add insert logic here
return View();
}
catch
{
return View();
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
cshtml查看:
@model DatePickerApp.Models.DatePickerClass
@{
ViewBag.Title …Run Code Online (Sandbox Code Playgroud)