FormView.PagerSettings Proprietà

Definizione

Ottiene un riferimento all'oggetto PagerSettings che consente di impostare le proprietà dei pulsanti di spostamento in un controllo FormView.

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

Valore della proprietà

Un riferimento all'oggetto PagerSettings che consente di impostare le proprietà dei pulsanti di spostamento in un controllo FormView.

Attributi

Esempio

Nell'esempio seguente viene illustrato come utilizzare la PagerSettings proprietà per specificare le proprietà della riga del cercapersone.


<%@ 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>

Commenti

Utilizzare la PagerSettings proprietà per controllare le impostazioni della riga del cercapersone in un FormView controllo . La riga del cercapersone viene visualizzata quando la funzionalità di paging è abilitata (quando la AllowPaging proprietà è impostata su true) e contiene i controlli che consentono all'utente di passare ai diversi record nel controllo. Questa proprietà è di sola lettura; Tuttavia, è possibile impostare le proprietà dell'oggetto PagerSettings restituito. Le proprietà possono essere impostate in modo dichiarativo nel formato Property-Subproperty, dove Subproperty è una proprietà dell'oggetto PagerSettings , PagerSettings-Modead esempio . Le proprietà possono anche essere impostate a livello di codice nel modulo Property.Subproperty , ad esempio PagerSettings.Mode. Le impostazioni comuni includono in genere la modalità di visualizzazione della riga del cercapersone e il testo o le immagini personalizzati per i controlli di spostamento.

Si applica a

Vedi anche