Search code examples
asp.netcssdatapager

ASP.NET 3.5 Customize DataPager


I currently have paging done manually and I use this code to display it

<div class="pages_numbers">
 <ul>
   <li><a href="#">1</a></li>
   <li><a href="#">2</a></li>
   <li><a href="#">&raquo; </a></li>
 </ul>
</div>

I want to use the DataPager control to do the paging for me, I've gotten the paging to work great, but I cant get the CSS Styles to stick and display correctly.


Solution

  • Added this to the datapager for seo

    QueryStringField="id"
    

    Then added CSS Classes to the elements and changed my CSS

    <Fields>
    <asp:NextPreviousPagerField FirstPageText="&lt;&lt;" ShowFirstPageButton="True" ShowNextPageButton="False" ShowPreviousPageButton="False" ButtonCssClass="PageItem" />
    <asp:NumericPagerField CurrentPageLabelCssClass="PageItem" NumericButtonCssClass="PageItem"  NextPreviousButtonCssClass="PageItem" />
    <asp:NextPreviousPagerField LastPageText="&gt;&gt;" ShowLastPageButton="True" ShowNextPageButton="False" ShowPreviousPageButton="False" ButtonCssClass="PageItem" />
    </Fields>