0

I am trying to construct an @Html.ActionLink to return to a previous page but to return to the previous page I need to pass in an id parameter.

ShowController/Details list a film defined by a int id, within this list is a link to go and look at the director details:

@Html.ActionLink( "(Director Bio)", "Index", "Director", new { searchString = item.Director.Name }, null)

When the user wants to go back to the film the StoreController/Details ActionResult is waiting for an int it.

I have tried to pass in the id to a viewBag:

     public ActionResult Details(int id)
    {
        var item = from s in db.Shows.Where(si => si.ShowId == id) select s;

        ViewBag.id = id;

        return View(item);
    }

And this shows fine in the Details view I cannot pick it up in the DirectorController/Index view to use in the actionLink, what do I do?

tereško
  • 58,060
  • 25
  • 98
  • 150
Spangle
  • 73
  • 1
  • 7

0 Answers0