我正在尝试使用一种表单来允许用户选择一个日期并通过 url 参数将其传递回控制器。我的意图是让表单提交一个看起来像 Payroll/Index/id?employeeID="foo"?DayInWeekInput="bar" 的 url。相反,这会生成 url Payroll/Index/id? 所以我显然做错了什么。我怎样才能用表格做到这一点?如果不可能,你能解释一下替代方案吗?谢谢。
using (Html.BeginForm("Index", "Payroll", new { id = @ViewBag.SupervisorID, employeeID=@ViewBag.EmployeeID }, FormMethod.Get))
{
@*@Html.AntiForgeryToken()*@
@Html.ValidationSummary(true)
<div class="editor-field">
<input type="date" id="DayInWeekInput" value="@string.Format("{0:yyyy-MM-dd}", Model.SpecifiedWeekStart)" />
<input type="submit" value="Go" />
</div>
}