1

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/?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>

Why the "Sample" method not called.

The error is "resource not found"

4

1 回答 1

1

我想这就是你要找的

@Html.ActionLink(
    "text for your link", 
    "Sample", // action method
    "Home",   // controller
    new { id = item.ImageId }, // your variable you want to pass
    null) 
于 2013-03-10T19:57:43.557 回答