0

私たちの MVC.Net アプリケーションは、コンテンツのないタグを返すことがあります。より具体的には、 と の間に何もありませ<>。返された HTML を調べるために IE-8 開発者ツールを起動すると、名前のない tag:<>とその終了タグ:が明らかになります</>。問題は断続的です。通常、ページを更新すると問題は解決します。しかし、それは十分に頻繁であり、ユーザーは経営陣がそれを修正することを望んでいるほど不平を言っています.

問題が発生すると、ブラウザの HTML ソースは次のようになります。

<TR sizcache="5" sizset="47">
    <TD class="label table-col-3">
        Manager:
    </TD>
    <TD class="table-col-7 last" sizcache="5" sizset="49">
        <A href="http://localhost:57791/Profile/22/Last%2c-First-MI" jQuery1359570774586="26">Last, First MI</A> 
    </TD>
</TR>
<>
  <div>
  </div>
</>

通常、ブラウザの HTML は次のようになります。

<TR sizcache="5" sizset="47">
    <TD class="label table-col-3">
        Manager:
    </TD>
    <TD class="table-col-7 last" sizcache="5" sizset="49">
        <A href="http://localhost:57791/Profile/22/Last%2c-First-MI" jQuery1359570774586="26">Last, First MI</A> 
    </TD>
</TR>
<TR id="link-admin-assistant-28" data-update="type: 'replace-portion', dataType: 'html', target: 'link-admin-assistant-28', source: 'link-admin-assistant-28'" sizcache="5" sizset="51">
    <TD class="label table-col-3">
        Admin Assistant:
    </TD>
    <TD class="table-col-7 last" sizcache="5" sizset="53">
        <A title="Edit Administrative Assistant" href="http://localhost:57791/Person/AdminAssistantForm?clientID=28" jQuery1359570774586="27">Last2, First2 M2</A> 
    </TD>
</TR>
<TR sizcache="5" sizset="55">
    <TD class="label table-col-3">
        Type:
    </TD>
    <TD class="table-col-7 last">
        Employee 
    </TD>
</TR>

アプリの詳細

アプリは MVC.Net 2 で構築されました。その後、.Net 4.0 を使用するようにアップグレードしました。また、クライアント側のスクリプト作成と AJAX 呼び出しの処理のための JQuery も多数あります。

ビューの *.ascx ページには整形式の HTML5 のみが含まれ、サーバー側のコード フラグメントが散在しているため、Web サーバーが "<>" タグを返す方法がわかりません。

この問題は、マネージャとマトリックス マネージャの IF ブロックの後のどこかで発生します。問題が発生すると、EmployeeType は表示されません。

問題が発生すると思われるコードのセクション (IE の開発ツールで表示される HTML に基づく)

<% if (managerPersonID != null && managerPersonID > 0 && !managerDisplayName.IsNullOrEmptyTrimmed()) { %>
<tr>
    <td class="label table-col-3">Manager:</td>
    <td class="table-col-7 last"><%--<a href="<%=Url.Action("Details", new { ID = manager.PersonID, Name = manager.DisplayName, GAL = "" })%>"><%=manager.DisplayName%></a>--%>
        <%= Html.ActionLink(managerDisplayName, "Details", "Person", new { ID = managerPersonID, Name = managerDisplayName.Replace(" ", "-"), GAL = "" }, new {}) %>
        <%--Matrix Manager--%>
        <% if (matrixPersonID != null && matrixPersonID > 0 && !matrixDisplayName.IsNullOrEmptyTrimmed()) { %>
            <span class="label">&#8212; Matrix:</span>
            <%--<a href="<%=Url.Action("Details", new { ID = matrixManager.PersonID, Name = matrixManager.DisplayName, GAL = "" }) %>"><%=matrixManager.DisplayName%></a>--%>
            <%= Html.ActionLink(matrixDisplayName, "Details", "Person", new { ID = matrixPersonID, Name = matrixDisplayName.Replace(" ", "-"), GAL = "" }, new {}) %>
        <% } %>
    </td>
</tr>
<% } %>

<!-- Error seems to occur somewhere after here -->

<%--Sponsoring Manager--%>
<% if (Model.SponsoringManagerPersonID != null && Model.SponsoringManagerPersonID > 0 && !Model.SponsoringManagerDisplayName.IsNullOrEmptyTrimmed()) { %>
<tr>
    <td class="label table-col-3">Sponsor:</td>
    <td class="table-col-7 last">
        <%--<a href="<%=Url.Action("Details", new { ID = Model.SponsoringManager.PersonID, Name = Model.SponsoringManager.DisplayName, GAL = "" })%>"><%=Model.SponsoringManager.DisplayName%></a>--%>
        <%= Html.ActionLink(Model.SponsoringManagerDisplayName, "Details", "Person", new { ID = Model.SponsoringManagerPersonID, Name = Model.SponsoringManagerDisplayName.Replace(" ", "-"), GAL = "" }, new {}) %>
    </td>
</tr>
<% } %>

<%-- Administrative Assistant --%>
<% Html.RenderPartial("AdminAssistant", Model.AdministrativeAssistant); %>

<%--Employee Type--%>
<tr>
    <td class="label table-col-3">Type:</td>
    <td class="table-col-7 last">
        <%= Enum.GetName(typeof(Person.PersonType), Model.EmployeeType ?? (int)Person.PersonType.Default) %>
    </td>
</tr>

 <!-- Error appears to occur somewhere before here -->

AdminAssistant 部分ビュー

<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<AdminAssistantLink>" %>
<%
    bool IsProfileView = ((bool?)ViewData["IsProfileView"]) ?? false;
    string AdminAssistLinkID = "link-admin-assistant-" + Model.ProfilePersonID;
%>
<%-- Administrative Assistant --%>
<% if (IsProfileView && Role.AllowProfileEditSpecific(Model.ProfilePersonID)) { %>
    <%--Edit mode--%>
    <tr id="<%= AdminAssistLinkID %>" data-update="type: 'replace-portion', dataType: 'html', target: '<%= AdminAssistLinkID %>', source: '<%= AdminAssistLinkID %>'">
        <td class="label table-col-3">Admin Assistant:</td>
        <td class="table-col-7 last">
            <% if (Model.AdminAssistantPersonID != null && !Model.AdminAssistantDisplayName.IsNullOrEmptyTrimmed()) { %>
                <%-- Display currently selected assistant, with link to edit --%>
                <%= Html.ActionLink(Model.AdminAssistantDisplayName, "AdminAssistantForm", "Person", new { clientID = Model.ProfilePersonID }, new { title = "Edit Administrative Assistant" }) %>
            <% } else { %>
                <%-- Display link to add assistant --%>
                <%= Html.ActionLink("Add Administrative Assistant", "AdminAssistantForm", "Person", new { clientID = Model.ProfilePersonID }, new {title = "Add Administrative Assistant" }) %>
            <% } %>
        </td>
    </tr>
<% } else { %>
    <%--Link to Profile--%>
    <% if (Model.AdminAssistantPersonID != null && !Model.AdminAssistantDisplayName.IsNullOrEmptyTrimmed()) { %>
    <tr>
        <td class="label table-col-3">Admin Assistant:</td>
        <td class="table-col-7 last">
            <%= Html.ActionLink(Model.AdminAssistantDisplayName, "Details", "Person", new { ID = Model.AdminAssistantPersonID, Name = Model.AdminAssistantDisplayName.Replace(" ", "-"), GAL = "" }, new {}) %>
        </td>
    </tr>
    <% } %>
<% } %>
4

1 に答える 1

0

多分それはあなたのコメントタグですか?これらは合法的なかみそりの構文ですか?

<%--Sponsoring Manager--%>
...
<%-- Administrative Assistant --%>
...
<%--Employee Type--%>

テストする MVC 2 サイトがないため、どのように表示されるかわかりません。MVC 3 では、タグはブラウザーのマークアップにそのまま表示されます。

于 2013-01-24T21:26:05.730 に答える