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

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

ButtonFieldBase.ShowHeader プロパティ

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

ButtonFieldBase オブジェクトヘッダー セクション表示するかどうかを示す値を取得または設定します

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

Public Overrides Property
 ShowHeader As Boolean
Dim instance As ButtonFieldBase
Dim value As Boolean

value = instance.ShowHeader

instance.ShowHeader = value
public override bool ShowHeader { get;
 set; }
/** @property */
public boolean get_ShowHeader ()

/** @property */
public void set_ShowHeader (boolean value)

プロパティ
ヘッダー セクション表示する場合trueそれ以外場合false既定値false です。

解説解説
使用例使用例

ShowHeader プロパティ使用して、DetailsView コントロールに ButtonField オブジェクトヘッダー セクション表示する方法次のコード例示します

<%@ Page language="VB" %>

<script runat="server">

    Sub ProductsDetailsView_ItemCommand(ByVal
 sender As Object, ByVal
 e As DetailsViewCommandEventArgs)
  
        If e.CommandName = "Add"
 Then

            ' Retrieve the current author's last name. In this example,
 the
            ' last name is displayed in the second cell (index 1) of
 the 
            ' second row (index 1).
            Dim lastName As String
 = ProductsDetailsView.Rows(1).Cells(1).Text
      
            ' Create a ListItem object to represent the author.
            Dim item As ListItem = New
 ListItem(lastName)
      
            ' Add the ListItem to the list box control if it does not
            ' already appear in the ListBox.
            If Not ProductsListBox.Items.Contains(item)
 Then

                ProductsListBox.Items.Add(item)
      
            End If
      
        End If
  
    End Sub

</script>

<html>
  <body>
    <form id="Form1" runat="server">
        
      <h3>ButtonFieldBase ShowHeader Example</h3>
      
      Click the Add button to add the product to
 the list box.
      
      <table cellpadding="30">
      
        <tr>
        
          <td>
        
            <!-- Set the ShowHeader property
 of the ButtonField -->
            <!-- declaratively to display the header section
 in -->
            <!-- that row.                                      -->
            <asp:detailsview id="ProductsDetailsView"
 
              datasourceid="ProductsSqlDataSource"
 
              autogeneraterows="false"
              allowpaging="true"
              gridlines="both"
              onitemcommand="ProductsDetailsView_ItemCommand"
   
              runat="server">
                
              <Fields>
                
                <asp:buttonfield buttontype="Link"
 
                  commandname="Add"
                  headertext="Add Product" 
                  showheader="true" 
                  text="Add"/>
                <asp:boundfield datafield="ProductID"
 
                  headertext="ID"/>
                <asp:boundfield datafield="ProductName"
 
                  headertext="Product"/>
                
              </Fields>
                
            </asp:detailsview>
            
            <!-- This example uses Microsoft SQL Server and
 connects -->
            <!-- to the Northwind sample database.        
                -->
            <asp:sqldatasource id="ProductsSqlDataSource"
  
              selectcommand="SELECT ProductName, ProductID FROM
 Products"
              connectionstring="<%$ ConnectionStrings:NorthwindConnection
 %>"
              runat="server">        
            </asp:sqldatasource>     
      
          </td>
          
          <td>
      
            Products List:<br/>
            <asp:listbox id="ProductsListBox" 
              runat="server"/>
         
          </td>
         
        </tr>
           
      </table>
            
    </form>
  </body>
</html>

<%@ Page language="C#" %>

<script runat="server">

  void ProductsDetailsView_ItemCommand(Object sender, DetailsViewCommandEventArgs
 e)
  {
  
    if(e.CommandName == "Add")
    {
      // Retrieve the current author's last name. In this example, the
      // last name is displayed in the second cell (index 1) of the
 
      // second row (index 1).
      string lastName = ProductsDetailsView.Rows[1].Cells[1].Text;
      
      // Create a ListItem object to represent the author.
      ListItem item = new ListItem(lastName);
      
      // Add the ListItem to the list box control if it does not
      // already appear in the ListBox.
      if(!ProductsListBox.Items.Contains(item))
      {
        ProductsListBox.Items.Add(item);
      }
      
    }
  
  }

</script>

<html>
  <body>
    <form runat="server">
        
      <h3>ButtonFieldBase ShowHeader Example</h3>
      
      Click the Add button to add the product to the list box.
      
      <table cellpadding="30">
      
        <tr>
        
          <td>
        
            <!-- Set the ShowHeader property of the ButtonField -->
            <!-- declaratively to display the header section in
 -->
            <!-- that row.                                      -->
            <asp:detailsview id="ProductsDetailsView" 
              datasourceid="ProductsSqlDataSource" 
              autogeneraterows="false"
              allowpaging="true"
              gridlines="both"
              onitemcommand="ProductsDetailsView_ItemCommand"   
              runat="server">
                
              <Fields>
                
                <asp:buttonfield buttontype="Link" 
                  commandname="Add"
                  headertext="Add Product" 
                  showheader="true" 
                  text="Add"/>
                <asp:boundfield datafield="ProductID" 
                  headertext="ID"/>
                <asp:boundfield datafield="ProductName" 
                  headertext="Product"/>
                
              </Fields>
                
            </asp:detailsview>
            
            <!-- This example uses Microsoft SQL Server and connects -->
            <!-- to the Northwind sample database.                        -->
            <asp:sqldatasource id="ProductsSqlDataSource"  
              selectcommand="SELECT ProductName, ProductID FROM Products"
              connectionstring="<%$ ConnectionStrings:NorthwindConnection
 %>"
              runat="server">        
            </asp:sqldatasource>     
      
          </td>
          
          <td>
      
            Products List:<br/>
            <asp:listbox id="ProductsListBox" 
              runat="server"/>
         
          </td>
         
        </tr>
           
      </table>
            
    </form>
  </body>
</html>

プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
ButtonFieldBase クラス
ButtonFieldBase メンバ
System.Web.UI.WebControls 名前空間
GridView
GridView.ShowHeader
DetailsView


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

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

辞書ショートカット

すべての辞書の索引

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

   

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



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

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

©2025 GRAS Group, Inc.RSS