【发布时间】:2015-02-05 08:11:14
【问题描述】:
我有两条返回同一页面的路线。两者都有效。两个页面都有正确的数据 - 除了我的 _layout 页面上的轮播不显示图像。
http://localhost:4556/Controller/Function/41 - 不起作用。
http://localhost:4556/Controller/Function?id=41 - 确实有效。
route.config 文件 ...
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
有人知道这是为什么吗?
_布局
The carousel I am using is such:
<div id="myCarousel" class="container carousel slide" data-ride="carousel">
<ol class="carousel-indicators"></ol>
<div class="carousel-inner" role="listbox"></div>
<a class="left carousel-control" href="#myCarousel" role="button" data-slide="prev">
<span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
<span class="sr-only">Previous</span>
</a>
<a class="right carousel-control" href="#myCarousel" role="button" data-slide="next">
<span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
<span class="sr-only">Next</span>
</a>
</div>
并且脚本中使用的图片路径是:ImagePath: "../Images/Carousel/default-image.png"
未正确显示广告的页面引用了布局页面,例如:
Layout = "~/Views/Shared/_Layout.cshtml";
【问题讨论】:
-
Both pages have the correct data- 这是什么意思?你是说ID被传递给Action吗?我们可以看到_Layout页面以及究竟是什么“不起作用”吗? -
ControllerController - 听起来不错)
-
嗨,是的,对不起。正确的 ID 被传递给控制器,我的“非布局”页面中的数据都是正确的并且被正确传递。更多内容......重新布局页面......
-
不起作用 = 轮播将图像显示为断开的链接。是否:轮播显示中的图像。感谢您的帮助:)
标签: asp.net-mvc controller routing routes