Calling method from view in mvc

Posted by Alice in wonderland on Stack Overflow See other posts from Stack Overflow or by Alice in wonderland
Published on 2010-03-18T20:08:08Z Indexed on 2010/03/18 20:11 UTC
Read the original article Hit count: 224

Filed under:

I'm implementing paging on an mvc view, and I want to call a method in the controller from the view

view:

>a href=">%= Url.Action("Search", new { page = NextPage(Request["exactPage"])).ToString()}) %>">

controller:

public string NextPage(string currentPage) { return (int.Parse(currentPage) + 1).ToString(); }

How can I call the NextPage method from the view?

thanks!

© Stack Overflow or respective owner

Related posts about asp.net-mvc