NextPreviousPagerField.PreviousPageImageUrl 屬性
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
取得或設定為 NextPreviousPagerField 物件中上一頁按鈕顯示之影像的 URL。
public:
property System::String ^ PreviousPageImageUrl { System::String ^ get(); void set(System::String ^ value); };
public string PreviousPageImageUrl { get; set; }
member this.PreviousPageImageUrl : string with get, set
Public Property PreviousPageImageUrl As String
屬性值
為 NextPreviousPagerField 物件中上一頁按鈕顯示之影像的 URL。 預設值是空字串 (""),表示未設定 PreviousPageImageUrl 屬性。
範例
下列範例示範如何使用 PreviousPageImageUrl 屬性,在控件的 對象中 NextPreviousPagerField 顯示上一頁按鈕的 DataPager 影像。
<%@ 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">
.header
{
background-color:Gray;
color:White;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<h3>NextPreviousPagerField Example</h3>
<asp:ListView ID="VendorsListView"
DataSourceID="VendorsDataSource"
runat="server">
<LayoutTemplate>
<table cellpadding="2" width="640px" border="1" runat="server" id="tblVendor">
<tr align="center" class="header" runat="server">
<th runat="server">ID</th>
<th runat="server">Vendor Name</th>
<th runat="server">Active</th>
</tr>
<tr id="itemPlaceholder" runat="server">
</tr>
</table>
</LayoutTemplate>
<ItemTemplate>
<tr runat="server">
<td>
<asp:Label ID="VendorIDLabel" runat="server" Text='<%#Eval("VendorID") %>' />
</td>
<td>
<asp:Label ID="NameLabel" runat="server" Text='<%#Eval("Name") %>' />
</td>
<td align="center">
<asp:CheckBox ID="ActiveFlagCheck" runat="server"
Checked='<%#Eval("ActiveFlag") %>'
Enabled="false" />
</td>
</tr>
</ItemTemplate>
</asp:ListView>
<asp:DataPager runat="server" ID="ContactsDataPager"
PagedControlID="VendorsListView"
PageSize="15">
<Fields>
<asp:NextPreviousPagerField
ShowFirstPageButton="true"
ShowLastPageButton="true"
FirstPageImageUrl="~/images/first.gif"
LastPageImageUrl="~/images/last.gif"
NextPageImageUrl="~/images/next.gif"
PreviousPageImageUrl="~/images/previous.gif"
ButtonType="Image" />
</Fields>
</asp:DataPager>
<!-- 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="VendorsDataSource" runat="server"
ConnectionString="<%$ ConnectionStrings:AdventureWorks_DataConnectionString %>"
SelectCommand="SELECT [VendorID], [Name], [ActiveFlag] FROM Purchasing.Vendor">
</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">
.header
{
background-color:Gray;
color:White;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<h3>NextPreviousPagerField Example</h3>
<asp:ListView ID="VendorsListView"
DataSourceID="VendorsDataSource"
runat="server">
<LayoutTemplate>
<table cellpadding="2" width="640px" border="1" runat="server" id="tblVendor">
<tr align="center" class="header" runat="server">
<th runat="server">ID</th>
<th runat="server">Vendor Name</th>
<th runat="server">Active</th>
</tr>
<tr id="itemPlaceholder" runat="server">
</tr>
</table>
</LayoutTemplate>
<ItemTemplate>
<tr runat="server">
<td>
<asp:Label ID="VendorIDLabel" runat="server" Text='<%#Eval("VendorID") %>' />
</td>
<td>
<asp:Label ID="NameLabel" runat="server" Text='<%#Eval("Name") %>' />
</td>
<td align="center">
<asp:CheckBox ID="ActiveFlagCheck" runat="server"
Checked='<%#Eval("ActiveFlag") %>'
Enabled="false" />
</td>
</tr>
</ItemTemplate>
</asp:ListView>
<asp:DataPager runat="server" ID="ContactsDataPager"
PagedControlID="VendorsListView"
PageSize="15">
<Fields>
<asp:NextPreviousPagerField
ShowFirstPageButton="true"
ShowLastPageButton="true"
FirstPageImageUrl="~/images/first.gif"
LastPageImageUrl="~/images/last.gif"
NextPageImageUrl="~/images/next.gif"
PreviousPageImageUrl="~/images/previous.gif"
ButtonType="Image" />
</Fields>
</asp:DataPager>
<!-- 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="VendorsDataSource" runat="server"
ConnectionString="<%$ ConnectionStrings:AdventureWorks_DataConnectionString %>"
SelectCommand="SELECT [VendorID], [Name], [ActiveFlag] FROM Purchasing.Vendor">
</asp:SqlDataSource>
</form>
</body>
</html>
備註
ButtonType當 屬性設定為 ButtonType.Image
且 ShowPreviousPageButton 屬性設定true
為 時,請使用 PreviousPageImageUrl 屬性來指定為上一頁按鈕所顯示影像的 URL。 此影像可以是瀏覽器支援的任何檔案格式 (.jpg、.gif、.bmp) 等等。
ButtonType當屬性設定為 以外的ButtonType.Image
值時,設定 PreviousPageImageUrl 屬性不會有任何作用。
此屬性的值會儲存在 viewstate 中。