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


ControlStyle プロパティは、DataControlField から派生した型に格納されているすべての Web サーバー コントロールの外観を制御します。
このプロパティは、一部の派生型には影響しません。通常はテキスト データの表示と TextBox コントロールだけを格納する BoundField コントロールは、Edit 状態のときに ControlStyle プロパティの影響だけを受けます。ButtonField や CheckBoxField などの Web サーバー コントロールは、これらのフィールドに格納されるコントロール オブジェクト インスタンスの特定の設定によっては ControlStyle プロパティの影響を受けることがあります。たとえば、ButtonField コントロールは、LinkButton、ImageButton、Button のいずれかのオブジェクトとして表示できます。LinkButton コントロールは指定した Style オブジェクトの font 属性の影響を受けますが、Button コントロールはこの影響を受けません。

DataControlField から派生する BoundField オブジェクトと ButtonField オブジェクトを使用して、DetailsView コントロールに行を表示する方法を次のコード例に示します。ButtonField オブジェクトの ControlStyle プロパティが設定され、フィールドに格納されている LinkButton コントロールの表示方法が制御されます。
<%@ page language="VB" %> <html> <body> <form runat="server"> <asp:detailsview id="DetailsView1" runat="server" allowpaging="True" datasourceid="SqlDataSource1" autogeneraterows="False" width="312px" height="152px"> <fields> <asp:boundfield visible="False" sortexpression="EmployeeID" datafield="EmployeeID"> </asp:boundfield> <asp:boundfield sortexpression="LastName" datafield="LastName" headertext="LastName"> </asp:boundfield> <asp:boundfield sortexpression="FirstName" datafield="FirstName" headertext="FirstName"> </asp:boundfield> <asp:boundfield sortexpression="Title" datafield="Title" headertext="Title"> </asp:boundfield> <asp:buttonfield text="Button"> <controlstyle font-bold="True" forecolor="Red" /> </asp:buttonfield> </fields> </asp:detailsview> <asp:sqldatasource id="SqlDataSource1" runat="server" selectcommand="SELECT * FROM Employees" connectionstring="<%$ ConnectionStrings:MyNorthwind%>"> </asp:sqldatasource> </form> </body> </html>
<%@ page language="C#" %> <html> <body> <form runat="server"> <asp:detailsview id="DetailsView1" runat="server" allowpaging="True" datasourceid="SqlDataSource1" autogeneraterows="False" width="312px" height="152px"> <fields> <asp:boundfield visible="False" sortexpression="EmployeeID" datafield="EmployeeID"> </asp:boundfield> <asp:boundfield sortexpression="LastName" datafield="LastName" headertext="LastName"> </asp:boundfield> <asp:boundfield sortexpression="FirstName" datafield="FirstName" headertext="FirstName"> </asp:boundfield> <asp:boundfield sortexpression="Title" datafield="Title" headertext="Title"> </asp:boundfield> <asp:buttonfield text="Button"> <controlstyle font-bold="True" forecolor="Red" /> </asp:buttonfield> </fields> </asp:detailsview> <asp:sqldatasource id="SqlDataSource1" runat="server" selectcommand="SELECT * FROM Employees" connectionstring="<%$ ConnectionStrings:MyNorthwind%>"> </asp:sqldatasource> </form> </body> </html>
<%@ page language="VJ#" %> <html> <body> <form runat="server"> <asp:detailsview id="DetailsView1" runat="server" allowpaging="True" datasourceid="SqlDataSource1" autogeneraterows="False" width="312px" height="152px"> <fields> <asp:boundfield visible="False" sortexpression="EmployeeID" datafield="EmployeeID"> </asp:boundfield> <asp:boundfield sortexpression="LastName" datafield="LastName" headertext="LastName"> </asp:boundfield> <asp:boundfield sortexpression="FirstName" datafield="FirstName" headertext="FirstName"> </asp:boundfield> <asp:boundfield sortexpression="Title" datafield="Title" headertext="Title"> </asp:boundfield> <asp:buttonfield text="Button"> <controlstyle font-bold="True" forecolor="Red" /> </asp:buttonfield> </fields> </asp:detailsview> <asp:sqldatasource id="SqlDataSource1" runat="server" selectcommand="Select * From Employees" connectionstring="Data Source=localhost;Integrated Security=SSPI;Initial Catalog=Northwind"> </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に収録されているすべての辞書からDataControlField.ControlStyle プロパティを検索する場合は、下記のリンクをクリックしてください。

- DataControlField.ControlStyle プロパティのページへのリンク