NextPreviousPagerField.ButtonCssClass 属性
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
获取或设置用于在浏览器上呈现页导航字段的按钮的级联样式表 (CSS) 类。
public:
property System::String ^ ButtonCssClass { System::String ^ get(); void set(System::String ^ value); };
public string ButtonCssClass { get; set; }
member this.ButtonCssClass : string with get, set
Public Property ButtonCssClass As String
属性值
用于在客户端上呈现页导航字段的按钮的 CSS 类。 默认值为空字符串,表示尚未设置 ButtonCssClass 属性。
示例
以下示例演示如何使用 ButtonCssClass 属性为控件的 对象DataPager中的NextPreviousPagerField按钮指定 CSS 类。
<%@ Page language="C#" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
<title>NextPreviousPagerField Example</title>
<style type="text/css">
.pager { background-color:Aqua; }
</style>
</head>
<body>
<form id="form1" runat="server">
<h3>NextPreviousPagerField Example</h3>
<asp:ListView ID="ContactsListView"
DataSourceID="ContactsDataSource"
runat="server">
<LayoutTemplate>
<table cellpadding="2" width="640px" border="1" runat="server" id="tblContacts">
<tr id="itemPlaceholder" runat="server">
</tr>
</table>
<asp:DataPager runat="server" ID="ContactsDataPager">
<Fields>
<asp:NextPreviousPagerField
ShowFirstPageButton="true"
ShowLastPageButton="true"
FirstPageText="|<< "
LastPageText=" >>|"
NextPageText=" > "
PreviousPageText=" < "
ButtonType="Button"
ButtonCssClass="pager" />
</Fields>
</asp:DataPager>
</LayoutTemplate>
<ItemTemplate>
<tr runat="server">
<td>
<asp:Label ID="ContactIDLabel" runat="server" Text='<%#Eval("ContactID") %>' />
</td>
<td>
<asp:Label ID="FirstNameLabel" runat="server" Text='<%#Eval("FirstName") %>' />
</td>
<td>
<asp:Label ID="LastNameLabel" runat="server" Text='<%#Eval("LastName") %>' />
</td>
</tr>
</ItemTemplate>
</asp:ListView>
<!-- This example uses Microsoft SQL Server and connects -->
<!-- to the AdventureWorks sample database. Use an ASP.NET -->
<!-- expression to retrieve the connection string value -->
<!-- from the Web.config file. -->
<asp:SqlDataSource ID="ContactsDataSource" runat="server"
ConnectionString="<%$ ConnectionStrings:AdventureWorks_DataConnectionString %>"
SelectCommand="SELECT [ContactID], [FirstName], [LastName] FROM Person.Contact">
</asp:SqlDataSource>
</form>
</body>
</html>
<%@ Page language="VB" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
<title>NextPreviousPagerField Example</title>
<style type="text/css">
.pager { background-color:Aqua; }
</style>
</head>
<body>
<form id="form1" runat="server">
<h3>NextPreviousPagerField Example</h3>
<asp:ListView ID="ContactsListView"
DataSourceID="ContactsDataSource"
runat="server">
<LayoutTemplate>
<table cellpadding="2" width="640px" border="1" runat="server" id="tblContacts">
<tr id="itemPlaceholder" runat="server">
</tr>
</table>
<asp:DataPager runat="server" ID="ContactsDataPager">
<Fields>
<asp:NextPreviousPagerField
ShowFirstPageButton="true"
ShowLastPageButton="true"
FirstPageText="|<< "
LastPageText=" >>|"
NextPageText=" > "
PreviousPageText=" < "
ButtonType="Button"
ButtonCssClass="pager" />
</Fields>
</asp:DataPager>
</LayoutTemplate>
<ItemTemplate>
<tr runat="server">
<td>
<asp:Label ID="ContactIDLabel" runat="server" Text='<%#Eval("ContactID") %>' />
</td>
<td>
<asp:Label ID="FirstNameLabel" runat="server" Text='<%#Eval("FirstName") %>' />
</td>
<td>
<asp:Label ID="LastNameLabel" runat="server" Text='<%#Eval("LastName") %>' />
</td>
</tr>
</ItemTemplate>
</asp:ListView>
<!-- This example uses Microsoft SQL Server and connects -->
<!-- to the AdventureWorks sample database. Use an ASP.NET -->
<!-- expression to retrieve the connection string value -->
<!-- from the Web.config file. -->
<asp:SqlDataSource ID="ContactsDataSource" runat="server"
ConnectionString="<%$ ConnectionStrings:AdventureWorks_DataConnectionString %>"
SelectCommand="SELECT [ContactID], [FirstName], [LastName] FROM Person.Contact">
</asp:SqlDataSource>
</form>
</body>
</html>
注解
ButtonCssClass使用 属性指定要在浏览器上呈现的页导航字段按钮的 CSS 类。 无论浏览器如何,此属性始终呈现为类属性。
注意
在不支持 CSS 的浏览器上 ButtonCssClass ,设置 属性不起作用。
此属性的值存储在 viewstate 中。