I'm already done with Header, Item, and Footer but not Pager using Bootstrap 3.0
Could you please guide me how to implement Bootstrap pagination in ASP.NET Gridview pager style?
Please help!
Additional information:::
Here is what I have done so far by adding CssClass. The table display perfect with Bootstrap style applied.
<div class="table-responsive">
<asp:GridView ID="grdSearchAgreement" runat="server" CssClass="table table-hover"
GridLines="None" AllowPaging="true" PageSize="2">
</asp:GridView>
</div>
And here is the Paging style that generated from ASP.NET GridView. It is table structure tr td.
<tr>
<td colspan="7"><table>
<tr>
<td><span>1</span></td><td><a href="javascript:__doPostBack('ctl00$body$grdSearchAgreement','Page$2')">2</a></td><td><a href="javascript:__doPostBack('ctl00$body$grdSearchAgreement','Page$3')">3</a></td>
</tr>
</table></td>
</tr>
But refer to Bootstrap 3.0 Pagination Document. The style can only apply to ul li. https://getbootstrap.com/docs/3.3/components/#pagination
<ul class="pagination">
<li><a href="#">«</a></li>
<li><a href="#">1</a></li>
<li><a href="#">2</a></li>
<li><a href="#">3</a></li>
<li><a href="#">4</a></li>
<li><a href="#">5</a></li>
<li><a href="#">»</a></li>
</ul>
How can I change tr td pager that generate from gridview to ul li??
I know this is old, But I found something, which is a css style, simple easy and fast
https://sufiawan.wordpress.com/2014/09/26/asp-net-use-bootstrap-pagination-on-gridview/
I hope it will save someone sometime.
update:
*In case the link is down:
You add the CSS
.pagination-ys {
/*display: inline-block;*/
padding-left: 0;
margin: 20px 0;
border-radius: 4px;
}
.pagination-ys table > tbody > tr > td {
display: inline;
}
.pagination-ys table > tbody > tr > td > a,
.pagination-ys table > tbody > tr > td > span {
position: relative;
float: left;
padding: 8px 12px;
line-height: 1.42857143;
text-decoration: none;
color: #dd4814;
background-color: #ffffff;
border: 1px solid #dddddd;
margin-left: -1px;
}
.pagination-ys table > tbody > tr > td > span {
position: relative;
float: left;
padding: 8px 12px;
line-height: 1.42857143;
text-decoration: none;
margin-left: -1px;
z-index: 2;
color: #aea79f;
background-color: #f5f5f5;
border-color: #dddddd;
cursor: default;
}
.pagination-ys table > tbody > tr > td:first-child > a,
.pagination-ys table > tbody > tr > td:first-child > span {
margin-left: 0;
border-bottom-left-radius: 4px;
border-top-left-radius: 4px;
}
.pagination-ys table > tbody > tr > td:last-child > a,
.pagination-ys table > tbody > tr > td:last-child > span {
border-bottom-right-radius: 4px;
border-top-right-radius: 4px;
}
.pagination-ys table > tbody > tr > td > a:hover,
.pagination-ys table > tbody > tr > td > span:hover,
.pagination-ys table > tbody > tr > td > a:focus,
.pagination-ys table > tbody > tr > td > span:focus {
color: #97310e;
background-color: #eeeeee;
border-color: #dddddd;
}
And just use inside the grd
<PagerStyle CssClass="pagination-ys" />
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With