使用 ASP MVC Web 应用程序。我有一个动态填充的表格来显示搜索结果。结果在 Chrome 和 FF 中看起来不错,但在 IE7 中,它在标题行上方添加了行。我在呈现的“页面源代码”中没有看到任何添加的源代码。
如下图所示,添加了一堆行(没有内容)。编写的 html(在 MVC 中)是:
<div class="detailSection">
<h2>Search Results</h2>
<p style="font-size:1.2em; font-weight: bold;">Applicant: <%: Html.DisplayFor(m => m.NewPersonModel.FirstName) %>
<%: Html.DisplayFor(m => m.NewPersonModel.LastName) %></p>
<p>Your search has returned the following results. If the current applicant has an existing record,
select the record and click the 'Compare' button at the end of the list.</p>
<% Html.BeginForm("Compare", "NewApplicant"); %>
<table id="s_ResultsTable" class="grid-striped">
<tr>
<th>Select</th>
<th>First Name</th>
<th>Middle Name</th>
<th>Last Name</th>
<th>Date of Birth</th>
<th>Alias?</th>
</tr>
<% if (Model.PersonSearchModel.Count == 0)
{ %>
<tr>
<td colspan="6">There are no matching volunteer records. <%: Html.ActionLink("Return to Detail page", "Detail", "NewApplicant", new { id = Model.NewPersonModel.ApplicantID }, null)%> to verify and save the application.</td>
</tr>
<%}%>
<% var rowCount = 0;
foreach (var item in Model.PersonSearchModel)
{ %>
<tr class="row<%: rowCount++%2 +1 %>">
<%: Html.HiddenFor(m => item.PersonID) %>
<%: Html.HiddenFor(m => m.NewPersonModel.ApplicantID) %>
<td class="resultsRadio"><%: Html.RadioButton("SelectedResult", item.PersonID) %></td>
<td><%: Html.DisplayFor(m => item.FirstName)%></td>
<td><%: Html.DisplayFor(m => item.MiddleName)%></td>
<td><%: Html.DisplayFor(m => item.LastName)%></td>
<td><%: Html.DisplayFor(m => item.DOB)%></td>
<td><%: Html.DisplayFor(m => item.IsAlias)%></td>
</tr>
<%}%>
</table>
<div id="searchButtonDiv">
<input type="hidden" id="SelectedPerson" name="SelectedPerson" value="" />
<input type="submit" id="submit" class="SKButton" value="Compare" />
<input type="button" class="SKButton" value="Back to Detail" title="Return to detail page" onclick="location.href='<%:@Url.Action("Detail", "NewApplicant", new { id = Model.NewPersonModel.ApplicantID }) %>'" />
</div>
<% Html.EndForm(); %>
</div>
这在浏览器中呈现为:
<p>Your search has returned the following results. If the current applicant has an existing record,
select the record and click the 'Compare' button at the end of the list.</p>
<form action="/webapps/Eligibility/NewApplicant/Compare" method="post">
<table id="s_ResultsTable" class="grid-striped">
<tr>
<th>Select</th>
<th>First Name</th>
<th>Middle Name</th>
<th>Last Name</th>
<th>Date of Birth</th>
<th>Alias?</th>
</tr>
<tr class="row1">
<input id="item_PersonID" name="item.PersonID" type="hidden" value="41838" />
<input id="NewPersonModel_ApplicantID" name="NewPersonModel.ApplicantID" type="hidden" value="718" />
<td class="resultsRadio"><input id="SelectedResult" name="SelectedResult" type="radio" value="41838" /></td>
<td>Steven</td>
<td></td>
<td>Amos</td>
<td>11/22/1977</td>
<td>No</td>
</tr>
<tr class="row2">
<input id="item_PersonID" name="item.PersonID" type="hidden" value="54477" />
<input id="NewPersonModel_ApplicantID" name="NewPersonModel.ApplicantID" type="hidden" value="718" />
<td class="resultsRadio"><input id="SelectedResult" name="SelectedResult" type="radio" value="54477" /></td>
<td>Steven</td>
<td></td>
<td>Atkinson</td>
<td>09/23/1963</td>
<td>No</td>
</tr>
</table>
<div id="searchButtonDiv">
<input type="hidden" id="SelectedPerson" name="SelectedPerson" value="" />
<input type="submit" id="submit" class="SKButton" value="Compare" />
<input type="button" class="SKButton" value="Back to Detail" title="Return to detail page" onclick="location.href='/webapps/Eligibility/NewApplicant/Detail/718'" />
</div>
</form>
</div>
以下是同一页面在任何其他浏览器中的呈现方式:
知道为什么会这样做吗?
编辑添加更多代码。我在渲染源代码中注意到的一件事是重复使用 ID,这显然应该是类。使用 MVC Html 助手设置 ID,所以我正在研究如何阻止它这样做并更改为一个类。