方法未被调用
本文关键字:调用 方法 | 更新日期: 2023-09-27 18:03:09
我尝试从我的视图页面调用一个方法,但它没有被调用。我的Home Controller示例代码是
public ActionResult Sample(Guid id)
{
List<Images> imgList = ImagesManager.GetAlllImages();
var bindlist = (from i in imgList where id == i.ImageId select i).ToList();
return RedirectToAction("Index",bindlist);
}
我的。cshtml页面(视图)代码我试图调用它的地方是
<div class="product">
<a href="Sample/?Id=@item.ImageId" class="info">
<span class="holder">
<img src="@item.ImagePath" alt="">
<span class="dd" >@item.ImageName</span>
<span class="author">by John Smith</span>
为什么没有调用"Sample"方法
错误是"resource not found"
我想这就是你要找的
@Html.ActionLink(
"text for your link",
"Sample", // action method
"Home", // controller
new { id = item.ImageId }, // your variable you want to pass
null)