0
我正在使用以下EditorTemplate确保datepicker为日期字段启用;网格中的MVC日期选择器
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<System.DateTime?>" %>
<%:Html.TextBox("", (Model.HasValue ? Model.Value.ToShortDateString() : string.Empty), new { @class = "datePicker" }) %>
然而,日期是在部分视图下面的视图;
<fieldset>
<legend>Enter the bank holidays here:</legend>
<table>
<tr>
<th>Bank Holiday</th>
<th>Date</th>
<th>Notes</th>
</tr>
<% foreach (var bankHolidayExtended in Model.BankHolidays)
{ %>
<% Html.RenderPartial("BankHolidaySummary", bankHolidayExtended); %>
<% } %>
<tr>
<td align="center" colspan="3" style="padding-top:20px;"><input type="submit" value="Submit" /></td>
</tr>
</table>
</fieldset>
局部视图看起来像这样,
<tr>
<td><%: Model.T.BankHolidayDescription%></td>
<td><%: Html.EditorFor(model => model.BH.NullableBankHolidayDate)%></td>
<td><%: Html.EditorFor(model => model.BH.BankHolidayComment)%></td>
</tr>
的问题是,该日期字段具有用于每行相同的ID。因此,当您在第x行输入日期时,它仅更新第1行的日期。 如何解决此问题,以便更新正确的行?