I'm using the MVCContrib Grid. My controller action accepts 3 parameters, the sortoptions and paging parameter for the grid, and a ResourceID parameter, that specifies which resource you want to view bids for.
When i click on the links i get the following error
The parameters dictionary contains a null entry for parameter 'ResourceId' of non-nullable type 'System.Int32' for method 'System.Web.Mvc.ActionResult ByResource(Int32, MvcContrib.UI.Grid.GridSortOptions, System.Nullable`1[System.Int32])' in 'TaskingApp.Controllers.BidController'. An optional parameter must be a reference type, a nullable type, or be declared as an optional parameter.
How do i pass in the ResourceId Parameter in properly?
Here is my Controller action
//Get bids by resource
public ActionResult ByResource(int ResourceId,GridSortOptions sort, int? page)
{
var bids = bidRepo.GetUpcomingBidsByResource(ResourceId);
if (sort.Column != null)
bids = bids.OrderBy(sort.Column, sort.Direction);
ViewData["sort"] = sort;
return View("Index", bids.AsPagination(page ?? 1, 15));
}
And here's the actionlink
<%= Html.ActionLink(item.ResourceName, "ByResource", new { id = item.ResourceID })%>