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

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

ButtonFieldBase.ButtonType プロパティ

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

ボタン フィールド表示するボタンの種類取得または設定します

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

Public Overridable Property
 ButtonType As ButtonType
Dim instance As ButtonFieldBase
Dim value As ButtonType

value = instance.ButtonType

instance.ButtonType = value
public virtual ButtonType ButtonType { get;
 set; }
public:
virtual property ButtonType ButtonType {
    ButtonType get ();
    void set (ButtonType value);
}
/** @property */
public ButtonType get_ButtonType ()

/** @property */
public void set_ButtonType (ButtonType value)
public function get ButtonType
 () : ButtonType

public function set ButtonType
 (value : ButtonType)

プロパティ
ButtonType 値の 1 つ既定値ButtonType.Link です。

例外例外
例外種類条件

ArgumentOutOfRangeException

ButtonType プロパティの値が、ButtonType 値ではありません。

解説解説
使用例使用例

ButtonType プロパティ使用して、GridView コントロールの ButtonField オブジェクトボタン表示されるように指定する方法次のコード例示します

<%@ Page language="VB" %>

<script runat="server">

  Sub AuthorsGridView_RowCommand(ByVal sender
 As Object, ByVal e As
 GridViewCommandEventArgs)
  
    ' If multiple ButtonField column fields are used, use the
    ' CommandName property to determine which button was clicked.
    If e.CommandName = "Select"
 Then
    
      ' Convert the row index stored in the CommandArgument
      ' property to an Integer.
      Dim index As Integer
 = Convert.ToInt32(e.CommandArgument)
    
      ' Get the last name of the selected author from the appropriate
      ' cell in the GridView control.
      Dim selectedRow As GridViewRow = AuthorsGridView.Rows(index)
      Dim lastNameCell As TableCell = selectedRow.Cells(1)
      Dim lastName As String
 = lastNameCell.Text
    
      ' Display the selected author.
      Message.Text = "You selected " & lastName
 & "."
      
    End If
    
  End Sub
    
</script>

<html>
  <body>
    <form runat="server">
        
      <h3>ButtonFieldBase ButtonType Example</h3>
      
      <asp:label id="Message"
        forecolor="Red"
        runat="server"/>
                    
      <!-- Populate the Columns collection declaratively. -->
      <asp:gridview id="AuthorsGridView" 
        datasourceid="AuthorsSqlDataSource" 
        autogeneratecolumns="false"
        onrowcommand="AuthorsGridView_RowCommand"
        runat="server">
                
        <columns>
                
          <asp:buttonfield buttontype="Button"
 
            commandname="Select"
            headertext="Select Author" 
            text="Select"/>
          <asp:boundfield datafield="au_lname"
 
            headertext="Last Name"/>
          <asp:boundfield datafield="au_fname"
 
            headertext="First Name"/>
                
        </columns>
                
      </asp:gridview>
            
      <!-- This example uses Microsoft SQL Server and connects
 -->
      <!-- to the Pubs sample database.                   
     -->
      <asp:sqldatasource id="AuthorsSqlDataSource"
  
        selectcommand="SELECT [au_lname], [au_fname] FROM [authors]"
        connectionstring="server=localhost;database=pubs;integrated
 security=SSPI"
        runat="server">
      </asp:sqldatasource>
            
    </form>
  </body>
</html>

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

<script runat="server">

  void AuthorsGridView_RowCommand(Object sender, GridViewCommandEventArgs
 e)
  {
  
    // If multiple ButtonField column fields are used, use the
    // CommandName property to determine which button was clicked.
    if(e.CommandName=="Select")
    {
    
      // Convert the row index stored in the CommandArgument
      // property to an Integer.
      int index = Convert.ToInt32(e.CommandArgument);    
    
      // Get the last name of the selected author from the appropriate
      // cell in the GridView control.
      GridViewRow selectedRow = AuthorsGridView.Rows[index];
      TableCell lastNameCell = selectedRow.Cells[1];
      string lastName = lastNameCell.Text;  
    
      // Display the selected author.
      Message.Text = "You selected " + lastName + ".";
      
    }
    
  }
    
</script>

<html>
  <body>
    <form runat="server">
        
      <h3>ButtonFieldBase ButtonType Example</h3>
      
      <asp:label id="Message"
        forecolor="Red"
        runat="server"/>
                    
      <!-- Populate the Columns collection declaratively. -->
      <asp:gridview id="AuthorsGridView" 
        datasourceid="AuthorsSqlDataSource" 
        autogeneratecolumns="false"
        onrowcommand="AuthorsGridView_RowCommand" 
        runat="server">
                
        <columns>
                
          <asp:buttonfield buttontype="Button" 
            commandname="Select"
            headertext="Select Author" 
            text="Select"/>
          <asp:boundfield datafield="au_lname" 
            headertext="Last Name"/>
          <asp:boundfield datafield="au_fname" 
            headertext="First Name"/>
                
        </columns>
                
      </asp:gridview>
            
      <!-- This example uses Microsoft SQL Server and connects -->
      <!-- to the Pubs sample database.                        -->
      <asp:sqldatasource id="AuthorsSqlDataSource"  
        selectcommand="SELECT [au_lname], [au_fname] FROM [authors]"
        connectionstring="server=localhost;database=pubs;integrated security=SSPI"
        runat="server">
      </asp:sqldatasource>
            
    </form>
  </body>
</html>

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


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

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

辞書ショートカット

すべての辞書の索引

「ButtonFieldBase.ButtonType プロパティ」の関連用語

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

   

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



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

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

©2025 GRAS Group, Inc.RSS