Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /?Column=ColumnName&Direction=Ascending
- Html.ActionLink("View 10", "Index", new { pageSize = 10 })
- /?PageSize=10
- /?Column=ColumnName&Direction=Ascending&PageSize=10
- Html.ActionLink(
- "View 10",
- "Index",
- new {
- Column = Request["Column"],
- Direction = Request["Direction"],
- pageSize = 10
- }
- )
- Html.PaginateLink("View 10", 10)
- public static class HtmlExtensions
- {
- public static MvcHtmlString PaginateLink(
- this HtmlHelper helper,
- string linkText,
- int pageSize
- )
- {
- var query = helper.ViewContext.HttpContext.Request.QueryString;
- var values = query.AllKeys.ToDictionary(key => key, key => (object)query[key]);
- values["pageSize"] = pageSize;
- var routeValues = new RouteValueDictionary(values);
- return helper.ActionLink(linkText, "Index", routeValues);
- }
- }
Add Comment
Please, Sign In to add comment