PagerSettings.Mode Propriedade

Definição

Obtém ou define o modo de exibição dos controles de paginação em um controle que dá suporte à paginação.Gets or sets the mode in which to display the pager controls in a control that supports pagination.

public:
 property System::Web::UI::WebControls::PagerButtons Mode { System::Web::UI::WebControls::PagerButtons get(); void set(System::Web::UI::WebControls::PagerButtons value); };
public System.Web.UI.WebControls.PagerButtons Mode { get; set; }
member this.Mode : System.Web.UI.WebControls.PagerButtons with get, set
Public Property Mode As PagerButtons

Valor da propriedade

PagerButtons

Um dos valores de PagerButtons.One of the PagerButtons values. O padrão é PagerButtons.Numeric.The default is PagerButtons.Numeric.

Exceções

O Mode é definido com um valor que não é um dos valores PagerButtons.The Mode is set to a value that is not one of the PagerButtons values.

Exemplos

O exemplo de código a seguir demonstra como usar a Mode propriedade para especificar que a linha do pager para um GridView controle deve exibir botões numéricos.The following code example demonstrates how to use the Mode property to specify that the pager row for a GridView control should display numeric buttons.


<%@ 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="NumericFirstLast"
            firstpagetext="First"
            lastpagetext="Last"
            pagebuttoncount="5"  
            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="NumericFirstLast"
            firstpagetext="First"
            lastpagetext="Last"
            pagebuttoncount="5"  
            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>

Comentários

Controles que dão suporte à paginação fornecem vários modos para exibir os controles de paginação.Controls that support pagination provide multiple modes in which to display the paging controls. Use a Mode propriedade para especificar o modo.Use the Mode property to specify the mode. A tabela a seguir descreve os diferentes modos para controles de paginação.The following table describes the different modes for pagination controls.

ModeMode DescriçãoDescription
NextPrevious Botões de página anterior e próxima página.Previous-page and next-page buttons.
NextPreviousFirstLast Botões de página anterior, próxima página, primeira página e última página.Previous-page, next-page, first-page, and last-page buttons.
Numeric Botões de link numerados para acessar as páginas diretamente.Numbered link buttons to access pages directly.
NumericFirstLast Botões numerados e de primeiro e último link.Numbered and first-link and last-link buttons.

Quando a Mode propriedade é definida como o NextPrevious NextPreviousFirstLast valor,, ou NumericFirstLast , você pode especificar o texto personalizado para os botões não numéricos definindo as propriedades mostradas na tabela a seguir.When the Mode property is set to the NextPrevious, NextPreviousFirstLast, or NumericFirstLast value, you can specify custom text for the non-numeric buttons by setting the properties shown in the following table.

PropriedadeProperty DescriçãoDescription
FirstPageText Texto do botão de primeira página.Text for the first-page button.
PreviousPageText Texto do botão de página anterior.Text for the previous-page button.
NextPageText Texto do botão de próxima página.Text for the next-page button.
LastPageText Texto do botão da última página.Text for the last-page button.

Como alternativa, você também pode exibir imagens para os botões não numéricos definindo as propriedades mostradas na tabela a seguir.As an alternative, you can also display images for the non-numeric buttons by setting the properties shown in the following table.

PropriedadeProperty DescriçãoDescription
FirstPageImageUrl A URL para uma imagem a ser exibida para o botão de primeira página.The URL to an image to display for the first-page button.
PreviousPageImageUrl A URL para uma imagem a ser exibida para o botão de página anterior.The URL to an image to display for the previous-page button.
NextPageImageUrl A URL para uma imagem a ser exibida para o botão de próxima página.The URL to an image to display for the next-page button.
LastPageImageUrl A URL para uma imagem a ser exibida para o botão da última página.The URL to an image to display for the last-page button.

Observação

Quando uma propriedade Image é definida, a propriedade Text correspondente atua como o texto alternativo para a imagem.When an image property is set, the corresponding text property acts as the alternate text for the image. Por exemplo, quando a FirstPageImageUrl propriedade é definida, o texto especificado pela FirstPageText propriedade é exibido como o texto alternativo para a imagem.For example, when the FirstPageImageUrl property is set, the text that is specified by the FirstPageText property is displayed as the alternate text for the image. Em navegadores que dão suporte a dicas de ferramenta, esse texto também é exibido como uma dica de ferramenta para o botão correspondente.On browsers that support ToolTips, this text is also displayed as a ToolTip for the corresponding button.

O valor dessa propriedade é armazenado em estado de exibição.The value of this property is stored in view state.

Aplica-se a

Confira também