處理ASP MVC網絡應用程序。我有一個動態填充表來顯示搜索結果。 Chrome和FF的結果看起來不錯,但是在IE7中它增加了標題行之上的行。沒有添加源代碼,我可以在呈現的「頁面源代碼」中看到。IE呈現額外表格行
正如你在下面的圖片中看到的那樣,添加了一堆行(沒有內容)。如寫(在MVC)的HTML是:
<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>
這裏是在同一個頁面是如何呈現在其他任何瀏覽器:
任何想法爲什麼它會這樣做嗎?
EDITTED添加更多的代碼。我在呈現的源代碼中注意到的一件事是重複使用ID,這顯然應該是類。使用MVC Html幫助器設置ID,所以我正在研究如何阻止它做到這一點,並改變爲一個類。
你可以發佈呈現的HTML嗎? – 2013-03-13 16:54:23