代码之家  ›  专栏  ›  技术社区  ›  Sergio Tapia

如何强式输入视图继承的内容?

  •  0
  • Sergio Tapia  · 技术社区  · 14 年前

    下面是试图继承的视图代码:

    <%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<UTEPSA.Helpers.PaginatedList<Area>>" %>
    
    <asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
        Index
    </asp:Content>
    
    <asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    
        <h2>Index</h2>
    
        <table>
            <tr>
                <th></th>
                <th>
                    ID
                </th>
                <th>
                    IDJefe
                </th>
                <th>
                    Nombre
                </th>
            </tr>
    
        <% foreach (var item in Model) { %>
    
            <tr>
                <td>
                    <%: Html.ActionLink("Edit", "Edit", new { id=item.ID }) %> |
                    <%: Html.ActionLink("Details", "Details", new { id=item.ID })%> |
                    <%: Html.ActionLink("Delete", "Delete", new { id=item.ID })%>
                </td>
                <td>
                    <%: item.ID %>
                </td>
                <td>
                    <%: item.IDJefe %>
                </td>
                <td>
                    <%: item.Nombre %>
                </td>
            </tr>
    
        <% } %>
    
        </table>
    
        <p>
            <%: Html.ActionLink("Create New", "Create") %>
        </p>
    
    </asp:Content>
    

    如何正确引用分页列表?因为视图继承了我想要的东西,所以我希望使用强类型模型。但是智能感知不起作用,所以出了点问题。

    1 回复  |  直到 14 年前
        1
  •  1
  •   marcind    14 年前

    必须将程序集同时添加到项目引用列表和 <system.web><compilation><assemblies> web.config的节。