DetailsView.CommandRowStyle プロパティ
メモ : このプロパティは、.NET Framework version 2.0 で新しく追加されたものです。
DetailsView コントロールのコマンド行の外観を設定できる TableItemStyle オブジェクトへの参照を取得します。
名前空間: System.Web.UI.WebControls
アセンブリ: System.Web (system.web.dll 内)
構文
プロパティ値
DetailsView コントロールのコマンド行のスタイルを表す TableItemStyle への参照。

CommandRowStyle プロパティを使用して、DetailsView コントロールのコマンド行の外観を制御します。コマンド行は、編集、削除、挿入などの操作を実行するためのコマンド ボタンを格納しています。このプロパティは読み取り専用です。ただし、このプロパティが返す TableItemStyle オブジェクトのプロパティを設定することはできます。このプロパティは、Property-Subproperty の形式で、宣言によって設定できます。Subproperty には、TableItemStyle オブジェクトのプロパティを指定します (例 : CommandRowStyle-ForeColor)。Property.Subproperty の形式で、プロパティをプログラムによって設定することもできます (例 : CommandRowStyle.ForeColor)。通常、共通設定には、カスタムの背景色、前景色、およびフォントのプロパティが含まれます。

CommandRowStyle プロパティを使用して、DetailsView コントロールのコマンド行のフォントおよびスタイルの設定を指定する方法のコード例を次に示します。
<%@ Page language="VB" %> <html> <body> <form id="Form1" runat="server"> <h3>DetailsView CommandRowStyle Example</h3> <asp:detailsview id="CustomerDetailsView" datasourceid="DetailsViewSource" autogeneraterows="false" datakeynames="CustomerID" gridlines="Both" allowpaging="true" runat="server"> <headerstyle backcolor="Navy" forecolor="White" /> <commandrowstyle backcolor="LightCyan" font-names="Arial" font-size="10" font-bold="true"/> <fields> <asp:commandfield ButtonType="Link" ShowEditButton="true"/> <asp:boundfield datafield="CustomerID" headertext="Customer ID" readonly="true"/> <asp:boundfield datafield="CompanyName" headertext="Company Name"/> <asp:boundfield datafield="Address" headertext="Address"/> <asp:boundfield datafield="City" headertext="City"/> <asp:boundfield datafield="PostalCode" headertext="Postal Code"/> <asp:boundfield datafield="Country" headertext="Country"/> </fields> </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#" %> <html> <body> <form id="Form1" runat="server"> <h3>DetailsView CommandRowStyle Example</h3> <asp:detailsview id="CustomerDetailsView" datasourceid="DetailsViewSource" autogeneraterows="false" datakeynames="CustomerID" gridlines="Both" allowpaging="true" runat="server"> <headerstyle backcolor="Navy" forecolor="White" /> <commandrowstyle backcolor="LightCyan" font-names="Arial" font-size="10" font-bold="true"/> <fields> <asp:commandfield ButtonType="Link" ShowEditButton="true"/> <asp:boundfield datafield="CustomerID" headertext="Customer ID" readonly="true"/> <asp:boundfield datafield="CompanyName" headertext="Company Name"/> <asp:boundfield datafield="Address" headertext="Address"/> <asp:boundfield datafield="City" headertext="City"/> <asp:boundfield datafield="PostalCode" headertext="Postal Code"/> <asp:boundfield datafield="Country" headertext="Country"/> </fields> </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>

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に収録されているすべての辞書からDetailsView.CommandRowStyle プロパティを検索する場合は、下記のリンクをクリックしてください。

- DetailsView.CommandRowStyle プロパティのページへのリンク