MVC3动作链接
在 MVC3 中,我有一个名为 test 的区域,其默认路由
context.MapRoute(
"test_default",
"test/{controller}/{action}/{id}",
new {controller="Store", action = "Index", id = UrlParameter.Optional },
new string[] { "foo.test.Controllers" }
);
@Html.ActionLink("Retour au magasin", "index", "Store") 生成 localhost:1111/test
在索引页面中,我有一个部分视图,位于文件夹测试/视图/共享 但它永远不是 rendererd,因为找不到该文件夹。
链接 http://localhost:1111/test/store/index 效果很好。 如何找到并呈现 http://localhost:1111/test 的部分视图?或者如何获取生成的链接 http://localhost:1111/test/Store/index通过操作链接?
谢谢
in MVC3 I have an area called test with a default route
context.MapRoute(
"test_default",
"test/{controller}/{action}/{id}",
new {controller="Store", action = "Index", id = UrlParameter.Optional },
new string[] { "foo.test.Controllers" }
);
@Html.ActionLink("Retour au magasin", "index", "Store") generates localhost:1111/test
In the index page I have a partial view, located in the folder test/views/shared
But it's never rendererd because the folder is not found.
The link http://localhost:1111/test/store/index works well.
How could I get the partial view found and rendered for the http:/localhost:1111/test? or how can I get the link http://localhost:1111/test/Store/index generated by the actionlink?
thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
看起来您正在将命名空间参数更改为
Area
之外的内容。如果您有测试区域,您的路线可能如下所示:It looks like you're changing your namespace argument to something outside the
Area
. If you have a test area, your route might look something like this: