mvc 没有代码隐藏强类型视图数据标头不起作用
我将其添加到我的标题 <%@ Page Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage" %>
并且能够访问 ViewData 及其所有内部结构以及所有 mvc 对象,例如 url 和 html。 一旦添加“System.Web.Mvc.ViewPage
”,我就无法访问任何 mvc 类和辅助方法。 我很困惑这是为什么。 我最近从 mvc Preview 5 升级到 rc1,但我到 rc1 的过渡是完美的,没有任何错误或错误。
I add that to my header <%@ Page Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage" %>
and am able to access ViewData and all its internals as well as all the mvc objects like url and html. As soon as I add "System.Web.Mvc.ViewPage<app.Models.tTable>
" I have no access to any mvc classes and helper methods. I am confused on why this is. I have done an upgrade from mvc preview 5 to rc1 recently but my transition to rc1 was flawless without any errors or bugs.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在钓鱼(大量钓鱼)后,我找到了答案,这是因为我没有阅读官方发行说明,而是浏览了博客中的教程,但任何人要使其正常工作,您都需要替换
;
节点位于“/Views”目录中的 web.config 文件中,我添加了来自预构建 web.config 文件的注释
After fishing (alot of fishing) around I found the answer, this is because I didn't read the official release notes rather ran through a tutorial from a blog but anywho to get this working you need to replace the
<pages>
node in the web.config file in your "/Views" directory withI added the commenting from a pre built web.config file
有一个技巧。 /Views 文件夹下有一个 web.config。 哇,我没看到。
感谢您发帖
There's a trick. There's a web.config under the /Views folder. Wow, I didn't see that.
Thanks for posting