PagerSettings.FirstPageText Proprietà

Definizione

Ottiene o imposta il testo da visualizzare per il pulsante di collegamento alla prima pagina.

public:
 property System::String ^ FirstPageText { System::String ^ get(); void set(System::String ^ value); };
public string FirstPageText { get; set; }
member this.FirstPageText : string with get, set
Public Property FirstPageText As String

Valore della proprietà

String

Testo da visualizzare per il pulsante di collegamento alla prima pagina. Il valore predefinito è "&lt;& lt;", che esegue il rendering come "<<".

Esempio

Nell'esempio di codice seguente viene illustrato come usare la FirstPageText proprietà per personalizzare il testo visualizzato per il pulsante della prima pagina della riga del pager in un GridView controllo.


<%@ 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="NextPreviousFirstLast"
            firstpagetext="First"
            lastpagetext="Last"
            nextpagetext="Next"
            previouspagetext="Prev"   
            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="NextPreviousFirstLast"
            firstpagetext="First"
            lastpagetext="Last"
            nextpagetext="Next"
            previouspagetext="Prev"   
            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>

Commenti

Quando la proprietà è impostata sul NextPreviousFirstLast valore oNumericFirstLast, utilizzare la Mode proprietà per specificare il FirstPageText testo da visualizzare per il pulsante della prima pagina.

Nota

In alternativa, è possibile visualizzare un'immagine per il pulsante della prima pagina impostando la proprietà anziché la FirstPageImageUrl FirstPageText proprietà. Se le FirstPageImageUrl proprietà e FirstPageText sono entrambe impostate, l'immagine viene visualizzata con la FirstPageText proprietà che funge da testo alternativo per l'immagine. Nei browser che supportano le descrizioni comandi, questo testo viene visualizzato anche come descrizione comando per il pulsante corrispondente.

Il valore di questa proprietà viene archiviato nello stato di visualizzazione.

Si applica a

Vedi anche