다음을 통해 공유


NextPreviousPagerField.ShowPreviousPageButton 속성

정의

NextPreviousPagerField 개체에 이전 페이지 단추가 표시되는지 여부를 나타내는 값을 가져오거나 설정합니다.

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

속성 값

이전 페이지 단추가 NextPreviousPagerField 개체에 표시되면 true이고, 그렇지 않으면 false입니다. 기본값은 true입니다.

예제

다음 예제에서는 사용 하는 방법의 ShowPreviousPageButton 이전 페이지 단추가 표시 되지 않도록 지정 하는 속성입니다.

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

설명

사용 합니다 ShowPreviousPageButton 속성의 이전 페이지 단추를 표시할지를 NextPreviousPagerField 개체입니다.

이 속성의 값은 viewstate에 저장 됩니다.

적용 대상

추가 정보