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