NextPreviousPagerField.ShowNextPageButton Propriété

Définition

Obtient ou définit une valeur qui indique si le bouton de page suivante est affiché dans un objet NextPreviousPagerField.

public:
 property bool ShowNextPageButton { bool get(); void set(bool value); };
public bool ShowNextPageButton { get; set; }
member this.ShowNextPageButton : bool with get, set
Public Property ShowNextPageButton As Boolean

Valeur de propriété

Boolean

true si le bouton de page suivante est affiché dans un objet NextPreviousPagerField ; sinon, false. La valeur par défaut est true.

Exemples

L’exemple suivant montre comment utiliser la propriété pour spécifier que le ShowNextPageButton bouton de page suivant ne doit pas être affiché.

<%@ 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>
  </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" PagedControlID="ContactsListView">
            <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>
        </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>
  </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" PagedControlID="ContactsListView">
            <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>
        </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>

Remarques

Utilisez la ShowNextPageButton propriété pour afficher ou masquer le bouton page suivant d’un NextPreviousPagerField objet.

La valeur de cette propriété est stockée dans viewstate.

S’applique à

Voir aussi