Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/pauldotknopf/paginglinksbuilder
A single .cs file for you to add to your project. It quickly adds a very configurable paging control to your project. It renders out-of-the-box Twitter Bootstrap fiendly too!
https://github.com/pauldotknopf/paginglinksbuilder
Last synced: 17 days ago
JSON representation
A single .cs file for you to add to your project. It quickly adds a very configurable paging control to your project. It renders out-of-the-box Twitter Bootstrap fiendly too!
- Host: GitHub
- URL: https://github.com/pauldotknopf/paginglinksbuilder
- Owner: pauldotknopf
- Created: 2012-12-30T04:01:23.000Z (almost 12 years ago)
- Default Branch: master
- Last Pushed: 2012-12-30T05:26:43.000Z (almost 12 years ago)
- Last Synced: 2023-03-25T22:57:12.428Z (over 1 year ago)
- Language: C#
- Homepage:
- Size: 122 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
PagingLinksBuilder.cs
==================A single .cs file for you to add to your project. It quickly adds a very configurable paging control to your project. It renders out-of-the-box Twitter Bootstrap fiendly too!
![PagingLinksBuidler preview](https://raw.github.com/theonlylawislove/PagingLinksBuilder/master/preview.jpg)
# Getting Started
Add [the only file](https://raw.github.com/theonlylawislove/PagingLinksBuilder/master/PagingLinksBuilder.cs) you need to your project.
Add the following to an HtmlHelper extension method somewhere.
```c#
public static PagingLinksBuilder PagingLinksBuilder
(this HtmlHelper helper,
int currentPage,
int totalPages,
Func pageUrlBuilder)
{
return new PagingLinksBuilder(currentPage, totalPages, pageUrlBuilder);
}
```Then use the following in your views.
```c#
@Html.PagingLinksBuilder(1, 10, (page) => "/somewhere?p=" + page)
```You are ready to rock-n-roll!
#Configuration/Defaults
The following represents a complete configuration of the defaults.
```c#
@(Html.PagingLinksBuilder(1, 10, (page) => "/somewhere?p=" + page)
.LayoutTemplate(
@)
@item
.ItemTemplate(
@
.LinkTemplate(
@@item.LinkText)
.MaxNumberOfTrailingLeadingPages(2)
.AlwaysShowNavigation(true)
.FirstCssClass("first")
.PreviousCssClass("previous")
.NextCssClass("next")
.LastCssClass("last")
.PageCssClass("page")
.DisabledCssClass("disabled")
.ActiveCssClass("active"))
```
Enjoy!