MvcSiteMapProvider 3.0 与 ASP.NET MVC3 和 Razor 的问题
我无法让 MvcSiteMapProvider 正常工作。 我已阅读 codeplex 上的文档,并按照它们显示的方式进行设置。
我已将 MvcSiteMapProvider.dll 引用到我的 Web 项目。
我遇到的问题是我根本无法访问 @Html.MvcSiteMap()
。 HtmlHelper 中缺少 .MvcSiteMap
。
有什么建议吗?
I am having trouble getting MvcSiteMapProvider to work.
I have read the documentation on codeplex, and set it up just like they show.
I have referenced the MvcSiteMapProvider.dll to my web project.
The problem I'm having is that I cant access @Html.MvcSiteMap()
at all. The .MvcSiteMap
is missing in the HtmlHelper.
Any suggestions ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您是否添加了对 web.config 的引用?正如此处所述。
编辑:好的,我下载了它,创建了新的 MVC 3 项目,引用了 dll 并将命名空间添加到两个配置中(一个在根目录,一个在 /Views/ 文件夹中),然后我就可以使用它了。 图片。
起初我在执行 Ctrl+C -> 时犯了一个错误将这些命名空间添加到 Web 配置中时按 Ctrl+V。我选择了他们提供的整个代码块并尝试将它们粘贴到网络配置中。这当然是错误的。您必须仅选择这两行
并将它们添加到元素中。也许你做对了,但我按照他们的步骤操作并且让它工作,所以如果你做了同样的事情并且它不适合你,你将必须提供你的代码。
或者,如果您无法使其正常工作,请尝试做我所做的事情。创建新的 mvc 项目,添加站点地图,将其添加到配置中并检查是否在视图中获取它。
Did you add references to web.config? As is described here.
Edit: Ok I downloaded it, made new MVC 3 project, referenced the dll and added the namespaces into two configs (one root and one in /Views/ folder) and I have it working. image.
At first I did a mistake in doing Ctrl+C -> Ctrl+V when adding those namespaces into web configs. I selected whole codeblocks they provide and tried to paste them into web configs. Which was of course wrong. You have to select only those two lines
And add them into element. Maybe you did it right, but I followed their steps and I got it working so you would have to provide your code if you did the same and it's not working for you.
Or if you won't get it working, then try to do what I did. Make new mvc project, add the sitemap, add it into config and check, if you are getting it in your View.