I'm trying to pass a value into an Html.Action using FirstOrDefault to return the first entry in an array of values. The value is not picked up and I keep getting a null exception.
The family
variable picks up the correct values from the model as a key/value pair.
What do I need to do to pass the zero indexed Value "2" as the parameter in the Action?
Code and debug information:
----Edit for Code---
Family Index Action
public ActionResult Index(int familyId)
{
var model = GetDisplay(familyId).OrderByDescending(i => i.dob);
return PartialView(model);
}
Family ViewModel
public partial class FamilyListViewModel
{
public int Id { get; set; }
public int familyId { get; set; }
public string name { get; set; }
...
}
This is actually a Dictionnary, you have to retrieve the value of your key like this :
@Html.Action("Index", "Family", new { familyId = family["Id"] })
Hope it helps !