DetailsView.PagerStyle プロパティとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > DetailsView.PagerStyle プロパティの意味・解説 

DetailsView.PagerStyle プロパティ

メモ : このプロパティは、.NET Framework version 2.0新しく追加されたものです。

DetailsView コントロールページ行の外観設定できる TableItemStyle オブジェクトへの参照取得します

名前空間: System.Web.UI.WebControls
アセンブリ: System.Web (system.web.dll 内)
構文構文

Public ReadOnly Property
 PagerStyle As TableItemStyle
Dim instance As DetailsView
Dim value As TableItemStyle

value = instance.PagerStyle
public TableItemStyle PagerStyle { get; }
public:
property TableItemStyle^ PagerStyle {
    TableItemStyle^ get ();
}
/** @property */
public TableItemStyle get_PagerStyle ()
public function get PagerStyle
 () : TableItemStyle

プロパティ
DetailsView コントロールページ行のスタイルを表す TableItemStyle への参照

解説解説

PagerStyle プロパティ使用してDetailsView コントロールページ行の外観制御しますページ行は、AllowPaging プロパティtrue設定してページング機能有効になっている場合表示されユーザーコントロール内の別のページ移動できるコントロール含まれます。このプロパティ読み取り専用です。ただし、このプロパティ返す TableItemStyle オブジェクトプロパティ設定することはできます。このプロパティは、Property-Subproperty形式で、宣言によって設定できますSubproperty には、TableItemStyle オブジェクトプロパティ指定します (例 : PagerStyle-ForeColor)。Property.Subproperty形式で、プロパティプログラムによって設定することもできます (例 : PagerStyle.ForeColor)。通常共通設定には、カスタム背景色前景色、およびフォントプロパティ含まれます。

使用例使用例

PagerStyle プロパティ使用してページ行のフォントおよびスタイル設定指定する方法コード例次に示します

<%@ Page language="VB" %>
<script runat="server">

    Protected Sub CustomerDetailView_DataBound(ByVal
 sender As Object, ByVal
 e As EventArgs)
        ' Get the pager row.
        Dim pagerRow As DetailsViewRow = CustomerDetailView.BottomPagerRow

        ' Get the Label controls that display the current page information
 
        ' from the pager row.
        Dim pageNum As Label = CType(pagerRow.Cells(0).FindControl("PageNumberLabel"),
 Label)
        Dim totalNum As Label = CType(pagerRow.Cells(0).FindControl("TotalPagesLabel"),
 Label)
        
        If (pageNum IsNot Nothing) And
 (totalNum IsNot Nothing) Then
            ' Update the Label controls with the current page values.
            Dim page As Integer
 = CustomerDetailView.DataItemIndex + 1
            Dim count As Integer
 = CustomerDetailView.DataItemCount

            pageNum.Text = page.ToString()
            totalNum.Text = count.ToString()
        End If
    End Sub

</script>

<html>

  <body>
    <form id="Form1" runat="server">
        
      <h3>DetailsView PagerTemplate Example</h3>
                
        <!-- Notice that the LinkButton controls in the pager
   -->
        <!-- template have their CommandName properties set.
    -->
        <!-- The DetailsView control automatically recognizes   -->
        <!-- certain command names and performs the appropriate
 -->
        <!-- operation. In this example, the CommandName  
      -->
        <!-- properties are set "Page"
 and the CommandArgument  -->
        <!-- properties are set to "Next"
 and "Prev", which     -->
        <!-- causes the DetailsView control to navigate to
 the  -->
        <!-- next and previous record, respectively.
            -->        
        <asp:detailsview id="CustomerDetailView"
          datasourceid="DetailsViewSource"
          autogeneraterows="true" 
          allowpaging="true"
        
          runat="server" OnDataBound="CustomerDetailView_DataBound">
               
          <headerstyle backcolor="Navy"
            forecolor="White"/>
            
          <pagerstyle VerticalAlign="Bottom" />
            
          <pagertemplate>
          
            <table width="100%">
              <tr>
                <td>
                  <asp:LinkButton id="PreviousButton"
                    text="<"
                    CommandName="Page"
                    CommandArgument="Prev"
                    runat="Server"/>
                  <asp:LinkButton id="NextButton"
                    text=">"
                    CommandName="Page"
                    CommandArgument="Next"
                    runat="Server"/> 
                </td>
                <td align="right">         
       
                  Page <asp:Label id="PageNumberLabel"
 runat="server" /> 
                  of <asp:Label id="TotalPagesLabel"
 runat="server" />                
                </td>
              </tr>
            </table>          
          </pagertemplate>   
                    
        </asp:detailsview>
        
        <!-- 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="DetailsViewSource"
 runat="server" 
          ConnectionString=
            "<%$ ConnectionStrings:NorthWindConnectionString%>"
            InsertCommand="INSERT INTO [Customers]([CustomerID],
 [CompanyName], [Address], [City], [PostalCode], [Country]) VALUES (@CustomerID,
 @CompanyName, @Address, @City, @PostalCode, @Country)"
          SelectCommand="Select [CustomerID], [CompanyName], 
            [Address], [City], [PostalCode], [Country] From 
            [Customers]">
        </asp:SqlDataSource>
    </form>
  </body>
</html>

<%@ Page language="C#" %>
<script runat="server">

    protected void CustomerDetailView_DataBound(object
 sender, EventArgs e)
    {

      // Get the pager row.
      DetailsViewRow pagerRow = CustomerDetailView.BottomPagerRow;

      // Get the Label controls that display the current page information
 
      // from the pager row.
      Label pageNum = (Label)pagerRow.Cells[0].FindControl("PageNumberLabel");
      Label totalNum = (Label)pagerRow.Cells[0].FindControl("TotalPagesLabel");

      if ((pageNum != null) && (totalNum
 != null))
      {
          // Update the Label controls with the current page values.
          int page = CustomerDetailView.DataItemIndex + 1;
          int count = CustomerDetailView.DataItemCount;

          pageNum.Text = page.ToString();
          totalNum.Text = count.ToString();
      }
    }

</script>

<html>

  <body>
    <form id="Form1" runat="server">
        
      <h3>DetailsView PagerTemplate Example</h3>
                
        <!-- Notice that the LinkButton controls in the pager
   -->
        <!-- template have their CommandName properties set.
    -->
        <!-- The DetailsView control automatically recognizes   -->
        <!-- certain command names and performs the appropriate -->
        <!-- operation. In this example, the CommandName  
      -->
        <!-- properties are set "Page" and the CommandArgument
  -->
        <!-- properties are set to "Next" and "Prev",
 which     -->
        <!-- causes the DetailsView control to navigate to the  -->
        <!-- next and previous record, respectively.            -->       
 
        <asp:detailsview id="CustomerDetailView"
          datasourceid="DetailsViewSource"
          autogeneraterows="true" 
          allowpaging="true"
        
          runat="server" OnDataBound="CustomerDetailView_DataBound">
               
          <headerstyle backcolor="Navy"
            forecolor="White"/>
            
          <pagerstyle VerticalAlign="Bottom" />
            
          <pagertemplate>
          
            <table width="100%">
              <tr>
                <td>
                  <asp:LinkButton id="PreviousButton"
                    text="<"
                    CommandName="Page"
                    CommandArgument="Prev"
                    runat="Server"/>
                  <asp:LinkButton id="NextButton"
                    text=">"
                    CommandName="Page"
                    CommandArgument="Next"
                    runat="Server"/> 
                </td>
                <td align="right">                
                  Page <asp:Label id="PageNumberLabel" runat="server"
 /> 
                  of <asp:Label id="TotalPagesLabel" runat="server"
 />                
                </td>
              </tr>
            </table>          
          </pagertemplate>   
                    
        </asp:detailsview>
        
        <!-- 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="DetailsViewSource" runat="server"
 
          ConnectionString=
            "<%$ ConnectionStrings:NorthWindConnectionString%>"
            InsertCommand="INSERT INTO [Customers]([CustomerID], [CompanyName],
 [Address], [City], [PostalCode], [Country]) VALUES (@CustomerID, @CompanyName,
 @Address, @City, @PostalCode, @Country)"
          SelectCommand="Select [CustomerID], [CompanyName], 
            [Address], [City], [PostalCode], [Country] From 
            [Customers]">
        </asp:SqlDataSource>
    </form>
  </body>
</html>

プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
DetailsView クラス
DetailsView メンバ
System.Web.UI.WebControls 名前空間
TableItemStyle
DetailsView.AllowPaging プロパティ
DetailsView.PagerSettings プロパティ
PagerTemplate


このページでは「.NET Framework クラス ライブラリ リファレンス」からDetailsView.PagerStyle プロパティを検索した結果を表示しています。
Weblioに収録されているすべての辞書からDetailsView.PagerStyle プロパティを検索する場合は、下記のリンクをクリックしてください。
 全ての辞書からDetailsView.PagerStyle プロパティ を検索

英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「DetailsView.PagerStyle プロパティ」の関連用語

DetailsView.PagerStyle プロパティのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



DetailsView.PagerStyle プロパティのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2025 Microsoft.All rights reserved.

©2025 GRAS Group, Inc.RSS