PagerSettings.LastPageImageUrl 属性

定义

获取或设置为最后一页按钮显示的图像的 URL。Gets or sets the URL to an image to display for the last-page button.

public:
 property System::String ^ LastPageImageUrl { System::String ^ get(); void set(System::String ^ value); };
public string LastPageImageUrl { get; set; }
member this.LastPageImageUrl : string with get, set
Public Property LastPageImageUrl As String

属性值

String

为最后一页按钮显示的图像的 URL。The URL to an image to display for the last-page button. 默认值为空字符串 (""),表示尚未设置 LastPageImageUrlThe default is an empty string (""), which indicates that the LastPageImageUrl is not set.

示例

下面的代码示例演示如何使用 LastPageImageUrl 属性为控件的页导航行中的最后一页按钮显示图像 GridViewThe following code example demonstrates how to use the LastPageImageUrl property to display an image for the last-page button in the pager row of a GridView control.


<%@ 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 runat="server">
    <title>PagerSetting Example</title>
</head>
<body>
    <form id="form1" runat="server">
        
      <h3>PagerSetting Example</h3>
                       
        <asp:gridview id="CustomerGridView"
          datasourceid="CustomerDataSource"
          autogeneratecolumns="true"
          datakeynames="CustomerID"  
          allowpaging="true"
          runat="server">
          
          <pagersettings mode="NextPreviousFirstLast"
            firstpageimageurl="~/Images/FirstPage.jpg"
            firstpagetext="First Page" 
            lastpageimageurl="~/Images/LastPage.jpg"
            lastpagetext="Last Page" 
            nextpageimageurl="~/Images/NextPage.jpg"
            nextpagetext="Next Page" 
            previouspageimageurl="~/Images/PreviousPage.jpg"
            previouspagetext="Previous Page"    
            position="Bottom"/> 
            
        </asp:gridview>
        
        <br/>
        
        <asp:label id="MessageLabel"
          forecolor="Red"
          runat="server"/>
            
        <!-- This example uses Microsoft SQL Server and connects  -->
        <!-- to the Northwind sample database. Use an ASP.NET     -->
        <!-- expression to retrieve the connection string value   -->
        <!-- from the Web.config file.                            -->
        <asp:sqldatasource id="CustomerDataSource"
          selectcommand="Select [CustomerID], [CompanyName], [Address], [City], [PostalCode], [Country] From [Customers]"
          connectionstring="<%$ ConnectionStrings:NorthWindConnectionString%>" 
          runat="server"/>
            
      </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 runat="server">
    <title>PagerSetting Example</title>
</head>
<body>
    <form id="form1" runat="server">
        
      <h3>PagerSetting Example</h3>
                       
        <asp:gridview id="CustomerGridView"
          datasourceid="CustomerDataSource"
          autogeneratecolumns="true"
          datakeynames="CustomerID"  
          allowpaging="true"
          runat="server">
          
          <pagersettings mode="NextPreviousFirstLast"
            firstpageimageurl="~/Images/FirstPage.jpg"
            firstpagetext="First Page" 
            lastpageimageurl="~/Images/LastPage.jpg"
            lastpagetext="Last Page" 
            nextpageimageurl="~/Images/NextPage.jpg"
            nextpagetext="Next Page" 
            previouspageimageurl="~/Images/PreviousPage.jpg"
            previouspagetext="Previous Page"    
            position="Bottom"/> 
            
        </asp:gridview>
        
        <br/>
        
        <asp:label id="MessageLabel"
          forecolor="Red"
          runat="server"/>
            
        <!-- This example uses Microsoft SQL Server and connects  -->
        <!-- to the Northwind sample database. Use an ASP.NET     -->
        <!-- expression to retrieve the connection string value   -->
        <!-- from the Web.config file.                            -->
        <asp:sqldatasource id="CustomerDataSource"
          selectcommand="Select [CustomerID], [CompanyName], [Address], [City], [PostalCode], [Country] From [Customers]"
          connectionstring="<%$ ConnectionStrings:NorthWindConnectionString%>" 
          runat="server"/>
            
      </form>
  </body>
</html>

注解

Mode 属性设置为 NextPreviousFirstLastNumericFirstLast 值时,请使用属性指定要为 LastPageImageUrl 最后一页按钮显示的图像的 URL。When the Mode property is set to the NextPreviousFirstLast or NumericFirstLast value, use the LastPageImageUrl property to specify the URL to an image to display for the last-page button.

备注

作为替代方法,您只需通过设置 LastPageText 属性而不是属性来显示最后一页按钮的文本 LastPageImageUrlAs an alternative, you can simply display text for the last-page button by setting the LastPageText property instead of the LastPageImageUrl property. 如果 LastPageImageUrl LastPageText 同时设置了和属性,则会显示图像,其 LastPageText 属性充当图像的替代文本。If the LastPageImageUrl and LastPageText properties are both set, the image is displayed with the LastPageText property acting as the alternate text for the image. 在支持工具提示的浏览器上,此文本还显示为相应按钮的工具提示。On browsers that support ToolTips, this text is also displayed as a ToolTip for the corresponding button.

此属性的值存储在视图状态中。The value of this property is stored in view state.

适用于

另请参阅