I have some code to get my data using a min_row/max_row. I want to pass in the page number rom my menu as well as the paging links.
My main menu has this code:
@Html.ActionLink("MyDocuments", "", "Home/MyDocuments/1")
My paging links look like this:
(they will be built on the fly from a total record count sent in the ViewBag, not done with that part yet):
<ul>
<li><a href="#">Prev</a></li>
<li class="active"><a href="/Home/MyDocuments/1">1</a></li>
<li><a href="/Home/MyDocuments/2">2</a></li>
<li><a href="/Home/MyDocuments/3">3</a></li>
<li><a href="/Home/MyDocuments/4">4</a></li>
<li><a href="#">Next</a></li>
</ul>
Here is my controller action:
public ActionResult MyDocuments(int Page)
{
string min = (Page-1*50).ToString();
string max = (50 / Page).ToString();
// mps is a webservice reference
Archive docs = mps.GetArchiveArray(LogonTicket, PID, "SortColumn", max, min, "ASC");
ViewBag.docs = docs;
return View();
}
Now, when I click on the main menu item, I get this error:
The parameters dictionary contains a null entry for parameter 'Page'
of non-nullable type 'System.Int32' for method 'System.Web.Mvc.ActionResult
MyDocuments(Int32)' in 'MVC3MySite.Controllers.HomeController'.
Here is my MapRoutes in Global.asax.cs:
routes.MapRoute(
"Default", // Route name
"{controller}/{action}/{id}", // URL with parameters
new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults
);
How do I circumvent this error?
Try changing
to