ASP.NET MVC: calling a controller method from view
- by Alice in wonderland
I'm implementing paging on an ASP.NET MVC view, and I want to call a method in the controller from the view.
Code in the view:
<a href="<%= Url.Action("Search",
new { page = NextPage(Request["exactPage"])).ToString()}) %>">
Controller method:
public string NextPage(string currentPage)
{
return (int.Parse(currentPage) + 1).ToString();
}
How can I call the NextPage method from the view?
thanks!