NumericPagerField.PreviousPageImageUrl Właściwość

Definicja

Pobiera lub ustawia adres URL obrazu wyświetlanego dla przycisku poprzedniej strony w NumericPagerField obiekcie.

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

Wartość właściwości

String

Adres URL obrazu, który jest wyświetlany dla przycisku poprzedniej strony w NumericPagerField obiekcie . Wartość domyślna to pusty ciąg (""), który wskazuje, że właściwość nie jest ustawiona PreviousPageImageUrl .

Przykłady

W poniższym przykładzie pokazano, jak wyświetlić obraz przycisku poprzedniej strony w NumericPagerField obiekcie kontrolki 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>NumericPagerField Example</title>
    <style type="text/css">
        .header { background-color:#8FBC8F; }
        table { border: solid 1px #000000; } 
    </style>
  </head>
  <body>
    <form id="form1" runat="server">
        
      <h3>NumericPagerField Example</h3>
          
      <asp:ListView ID="VendorsListView" 
        DataSourceID="VendorsDataSource"
        runat="server">
        <LayoutTemplate>
          <table cellpadding="2" width="640px" runat="server" id="tblVendor">
            <tr align="center" class="header" runat="server">
              <td runat="server">ID</td>
              <td runat="server">Vendor Name</td>
              <td runat="server">Active</td>
            </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="10">
        <Fields>
          <asp:NumericPagerField
            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>NumericPagerField Example</title>
    <style type="text/css">
        .header { background-color:#8FBC8F; }
        table { border: solid 1px #000000; } 
    </style>
  </head>
  <body>
    <form id="form1" runat="server">
        
      <h3>NumericPagerField Example</h3>
          
      <asp:ListView ID="VendorsListView" 
        DataSourceID="VendorsDataSource"
        runat="server">
        <LayoutTemplate>
          <table cellpadding="2" width="640px" runat="server" id="tblVendor">
            <tr align="center" class="header" runat="server">
              <td runat="server">ID</td>
              <td runat="server">Vendor Name</td>
              <td runat="server">Active</td>
            </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="10">
        <Fields>
          <asp:NumericPagerField
            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>

Uwagi

ButtonType Gdy właściwość jest ustawiona na ButtonType.Imagewartość , użyj PreviousPageImageUrl właściwości , aby określić adres URL obrazu wyświetlanego dla przycisku poprzedniej strony. Obraz może być w dowolnym formacie pliku obsługiwanym w przeglądarkach, takich jak .jpg, .gif, .bmp i .png.

Gdy właściwość jest ustawiona ButtonType na wartość inną niż ButtonType.Image, ustawienie PreviousPageImageUrl właściwości nie ma wpływu.

Wartość tej właściwości jest przechowywana w stanie widoku.

Dotyczy

Zobacz też