ButtonFieldBase.ButtonType プロパティ
アセンブリ: System.Web (system.web.dll 内)

Dim instance As ButtonFieldBase Dim value As ButtonType value = instance.ButtonType instance.ButtonType = value
/** @property */ public ButtonType get_ButtonType () /** @property */ public void set_ButtonType (ButtonType value)
ButtonType 値の 1 つ。既定値は ButtonType.Link です。



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>

Windows 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


Weblioに収録されているすべての辞書からButtonFieldBase.ButtonType プロパティを検索する場合は、下記のリンクをクリックしてください。

- ButtonFieldBase.ButtonType プロパティのページへのリンク