FormView.PagerStyle Propiedad

Definición

Obtiene una referencia al objeto TableItemStyle que le permite establecer el aspecto de la fila de paginación en un control FormView.

public:
 property System::Web::UI::WebControls::TableItemStyle ^ PagerStyle { System::Web::UI::WebControls::TableItemStyle ^ get(); };
[System.Web.UI.PersistenceMode(System.Web.UI.PersistenceMode.InnerProperty)]
public System.Web.UI.WebControls.TableItemStyle PagerStyle { get; }
[<System.Web.UI.PersistenceMode(System.Web.UI.PersistenceMode.InnerProperty)>]
member this.PagerStyle : System.Web.UI.WebControls.TableItemStyle
Public ReadOnly Property PagerStyle As TableItemStyle

Valor de propiedad

Referencia a TableItemStyle que representa el estilo de la fila de paginación en un control FormView.

Atributos

Ejemplos

En el ejemplo siguiente se muestra cómo usar la PagerStyle propiedad para especificar la configuración de estilo de la fila del buscapersonas.


<%@ 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>FormView AllowPaging Example</title>
</head>
<body>
    <form id="form1" runat="server">
        
      <h3>FormView AllowPaging Example</h3>
                       
      <asp:formview id="EmployeeFormView"
        datasourceid="EmployeeSource"
        allowpaging="true"
        datakeynames="EmployeeID" 
        runat="server">
        
        <pagersettings mode="Numeric"
          position="Bottom"/>
          
        <pagerstyle backcolor="LightBlue"
          horizontalalign="Center"/>
        
        <itemtemplate>
        
          <table>
            <tr>
              <td>
                <asp:image id="EmployeeImage"
                  imageurl='<%# Eval("PhotoPath") %>'
                  alternatetext='<%# Eval("LastName") %>' 
                  runat="server"/>
              </td>
              <td>
                <h3><%# Eval("FirstName") %> <%# Eval("LastName") %></h3>      
                <%# Eval("Title") %>        
              </td>
            </tr>
          </table>
        
        </itemtemplate> 
                  
      </asp:formview>
          
      <!-- 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="EmployeeSource"
        selectcommand="Select [EmployeeID], [LastName], [FirstName], [Title], [PhotoPath] From [Employees]"
        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>FormView AllowPaging Example</title>
</head>
<body>
    <form id="form1" runat="server">
        
      <h3>FormView AllowPaging Example</h3>
                       
      <asp:formview id="EmployeeFormView"
        datasourceid="EmployeeSource"
        allowpaging="true"
        datakeynames="EmployeeID" 
        runat="server">
        
        <pagersettings mode="Numeric"
          position="Bottom"/>
          
        <pagerstyle backcolor="LightBlue"
          horizontalalign="Center"/>
        
        <itemtemplate>
        
          <table>
            <tr>
              <td>
                <asp:image id="EmployeeImage"
                  imageurl='<%# Eval("PhotoPath") %>'
                  alternatetext='<%# Eval("LastName") %>' 
                  runat="server"/>
              </td>
              <td>
                <h3><%# Eval("FirstName") %> <%# Eval("LastName") %></h3>      
                <%# Eval("Title") %>        
              </td>
            </tr>
          </table>
        
        </itemtemplate> 
                  
      </asp:formview>
          
      <!-- 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="EmployeeSource"
        selectcommand="Select [EmployeeID], [LastName], [FirstName], [Title], [PhotoPath] From [Employees]"
        connectionstring="<%$ ConnectionStrings:NorthWindConnectionString%>" 
        runat="server"/>
            
    </form>
  </body>
</html>

Comentarios

Utilice la PagerStyle propiedad para controlar la apariencia de la fila del buscapersonas en un FormView control . La fila del buscapersonas se muestra cuando la característica de paginación está habilitada (cuando la AllowPaging propiedad está establecida trueen ) y contiene los controles que permiten al usuario navegar a las distintas páginas del control. Esta propiedad es de solo lectura; sin embargo, puede establecer las propiedades del TableItemStyle objeto que devuelve. Las propiedades se pueden establecer mediante declaración mediante uno de los métodos siguientes:

  • Coloque un atributo en la etiqueta de apertura del FormView control con el formato Property-Subproperty, donde Subproperty es una propiedad del TableItemStyle objeto (por ejemplo, PagerStyle-ForeColor).

  • Anida un <PagerRowStyle> elemento entre las etiquetas de apertura y cierre del FormView control.

Las propiedades también se pueden establecer mediante programación en el formulario Property.Subproperty (por ejemplo, PagerStyle.ForeColor). La configuración común suele incluir un color de fondo personalizado, un color de primer plano y propiedades de fuente.

Se aplica a

Consulte también