I create a strong typed view ,but i can't get the Mode and viewdata and the Html... This is my sample code:
<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<MiniMain.ViewModel.ArticleViewdata>" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
<%Model %>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<h2>ViewPage1</h2>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="refereFiles" runat="server">
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="Breadcrumbs" runat="server">
</asp:Content>
Remember to add this to your web.config
file:
<pages pageParserFilterType="System.Web.Mvc.ViewTypeParserFilter, System.Web.Mvc, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"
pageBaseType="System.Web.Mvc.ViewPage, System.Web.Mvc"
userControlBaseType="System.Web.Mvc.ViewUserControl, System.Web.Mvc">
<namespaces>
<add namespace="System"/>
<add namespace="System.Linq"/>
<add namespace="System.Collections.Generic"/>
<add namespace="System.Web.Mvc"/>
<add namespace="System.Web.Mvc.Html"/>
<add namespace="Microsoft.Web.Mvc"/>
</namespaces>
</pages>
The pageParserFilterType
attribute in particular will enable you to use the "generic" syntax to define the class from which your pages inherit. Otherwise, you'd have to use the standard way to specify generic base classes:
Inherits="System.Web.Mvc.ViewPage`1[[MiniMain.ViewModel.ArticleViewdata]]"