sd_dracula
sd_dracula

Reputation: 3896

.net changing ListView buttons

Changing buttons like Insert, Delete of a ListView is fine since they are just normal asp:buttons but how to go about changing the page buttons (i.e First and Last) if paging is enabled on a ListView?

They are of type:

<asp:DataPager ID="DataPager1" runat="server">
     <Fields>
           <asp:NextPreviousPagerField ButtonType="Button" ShowFirstPageButton="True" 
                      ShowNextPageButton="False" ShowPreviousPageButton="False" />
                 <asp:NumericPagerField />
                 <asp:NextPreviousPagerField ButtonType="Button" ShowLastPageButton="True" 
                      ShowNextPageButton="False" ShowPreviousPageButton="False" />
     </Fields>
</asp:DataPager>

Just need to change ForeColor and BackColor attributes.

Upvotes: 0

Views: 474

Answers (2)

user1425647
user1425647

Reputation: 66

You can add your own css class and assign it to Button tags of the DataPager control. there is a property called ButtonCssClass for button tags inside DataPager .

NumericPagerField styles can change by assign css class for NumericButtonCssClass property of NumericPagerField.

<asp:DataPager ID="DataPager1" runat="server">
    <Fields>
        <asp:NextPreviousPagerField ButtonType="Button" ButtonCssClass="DataPagerbtnStyle"
            ShowFirstPageButton="True" ShowNextPageButton="False" ShowPreviousPageButton="False" />
        <asp:NumericPagerField NumericButtonCssClass="DataPagerNumericStyle" />
        <asp:NextPreviousPagerField ButtonCssClass="DataPagerbtnStyle" ButtonType="Button"
            ShowLastPageButton="True" ShowNextPageButton="False" ShowPreviousPageButton="False" />
    </Fields>
</asp:DataPager>

Upvotes: 0

Saeed Neamati
Saeed Neamati

Reputation: 35842

You have to use it's templating capabilities, just like any other ASP.NET server control. See this question.

Upvotes: 2

Related Questions