开发者

How to create a project with aspx and cshtml both

i have a MVC based project who is built in MVC2 i migrate them using the tool. atleast they work fine.

but when i delete some views and make cshtml views their that i found that's not work as they work before.

their is a problem that when i see the views in Visual studio i found that

Error 1 The name 'ViewBag' does not exist in the current context Error 2 The name 'RenderBody' does not exist in the 开发者_开发百科current context

when i debug them i found that

CS0234: The type or namespace name 'Helpers' does not exist in the namespace 'System.Web' (are you missing an assembly reference?)

how i can solve this issue in asp.net mvc3


There are members of the base razor view, which is typically specified in the web.config in the /views folder, typically with contents like:

  <system.web.webPages.razor>
    <host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
    <pages pageBaseType="System.Web.Mvc.WebViewPage">
      <namespaces>
        <add namespace="System.Web" />
        <add namespace="System.Web.Mvc" />
        <add namespace="System.Web.Mvc.Ajax" />
        <add namespace="System.Web.Mvc.Html" />
        <add namespace="System.Web.Routing" />

        <add namespace="your-project-stuff-here"/>
      </namespaces>
    </pages>
  </system.web.webPages.razor>

The pageBaseType is probably what you are missing.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜