我尝试从我的视图页调用一个方法,但它没有被调用。 家庭控制器的我的示例代码HomeController中的方法不叫
而且从那里我试图把它叫做我的.cshtml网页(视图)代码
<div class="product">
<a href="Sample/[email protected]" class="info">
<span class="holder">
<img src="@item.ImagePath" alt="">
<span class="dd" >@item.ImageName</span>
<span class="author">by John Smith</span>
为什么不叫“样品”的方法。
是“资源未找到”错误
MVC没有通过这样的变量。检查这个答案也许,这有助于你进一步http://stackoverflow.com/questions/155864/asp-net-mvc-passing-parameters-to-the-controller – bas 2013-03-10 19:28:23
虽然它不是理想的MVC形式,查询字符串可以用过的。这是你的路线错误。示例是一个动作,而不是控制器。在这种情况下,您的路线应该是“{Controller}/Sample?....”。或者更好的是,@bas指出,你应该使用一个ActionLink助手。 – 2013-03-10 19:32:03
@DaveA示例是行动,但在我以前的应用程序中,我使用它相同,它的工作原理,但不是现在请给更多的建议,谢谢 – 2013-03-10 19:38:57