Skip to content

Instantly share code, notes, and snippets.

@markholdt
Created January 9, 2016 16:36
Show Gist options
  • Save markholdt/b6ce8d2d79251092ff8e to your computer and use it in GitHub Desktop.
Save markholdt/b6ce8d2d79251092ff8e to your computer and use it in GitHub Desktop.
Paging - jquery bootstrap
<script src="~/scripts/jquery.twbsPagination.min.js"></script>
<script type="text/javascript">
var requestParameters = document.URL.split('?');
var params = '';
if (requestParameters[1] != null) {
var parLines = requestParameters[1].split('&');
var count = 0;
while (parLines[count] != null) {
var t = parLines[count];
if (t.indexOf('PageNr') === -1) {
params = (params === '' ? t : '&' + t);
}
count = count + 1;
}
}
$('#pagination-demo').twbsPagination({
totalPages: @Model.TotalPageCount,
visiblePages: 5,
startPage: @Model.CurrentPageNr,
href: '?' + params + '&PageNr={{number}}'
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment