I'm trying to add an ActionLink to a webgrid column but am running into problems.
If I add the action link like so, it works and links to the main UserDetails page:
grid.Column(header: "", format: (item) => Html.ActionLink("Details", "UserDetails", "Admin"))
However, if I try to pass in the user of the grid item, it returns empty string.
This:
grid.Column(header: "", format: (item) => Html.ActionLink("Details", "UserDetails", "Admin", new { username = item.user }, null))
Results in this:
<a href="">
I've searched this site and have tried some variations but none have worked. Including:
grid.Column(header: "", format: @<text>@Html.ActionLink("Details", "UserDetails", "Admin", new { username = (string)item.user }, null)</text>)
In my controller I have:
public ActionResult UserDetails(string username)
{
return View();
}
My model for this view and grid is a
List<UserInfo>
where UserInfo has "user" and "activedate".
I'm still new to MVC so I'm hoping there is something silly I'm overlooking.
Thanks.