在我的剃刀视图中,我有一个简单的表单,它将接受用户的日期:
@using (Html.BeginForm("CancelByDate", "ClassExample", FormMethod.Post, new { id = "dateForm" }))
{
<input id="dateInput" type="date" width="10" class="date" />
<input type="submit" value="Continue" />
}
如何在我的 CancelByDate 操作中获取这些数据?
我尝试了几种方法:
public ActionResult CancelByDate(DateTime dateInput) // <---- This value will be null
{
return View();
}
public ActionResult CancelByDate(String dateInput) // <---- This value will be null
{
return View();
}
public ActionResult CancelByDate(object dateInput) // <---- This value will be some object, but there is no way to find out what is the underlying type even with GetType();
{
return View();
}
所以我想知道我错过了什么?