Reputation: 186
I try to call a method from my view page but it is not called. My sample code of Home Controller is
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);
}
And my .cshtml page(view ) code from where I try to call it is
<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>
Why the "Sample" method not called.
The error is "resource not found"
Upvotes: 1
Views: 899
Reputation: 14982
I think this is what you are looking for
@Html.ActionLink(
"text for your link",
"Sample", // action method
"Home", // controller
new { id = item.ImageId }, // your variable you want to pass
null)
Upvotes: 1