0

更改诸如插入、删除 ListView 之类的按钮很好,因为它们只是普通的 asp:buttons,但是如果在 ListView 上启用了分页,如何更改页面按钮(即第一个和最后一个)?

它们的类型:

<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>

只需要更改 ForeColor 和 BackColor 属性。

4

2 回答 2

2

您必须使用它的模板功能,就像任何其他 ASP.NET 服务器控件一样。看到这个问题

于 2012-06-03T18:57:59.277 回答
0

您可以添加自己的 css 类并将其分配给 DataPager 控件的 Button 标记。DataPager 中的按钮标签有一个名为 ButtonCssClass 的属性。

NumericPagerField 样式可以通过为 NumericPagerField 的 NumericButtonCssClass 属性分配 css 类来更改。

<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>
于 2012-06-03T19:28:58.623 回答