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

DataControlField に表示されるテキストの外観を制御する TableItemStyle。

ItemStyle プロパティは、DataControlField から派生した型に格納されているすべてのテキスト データの外観を制御します。たとえば、BoundField コントロールをテキスト データにバインドする場合、ItemStyle プロパティを使用して、表示されるテキストの外観を変更できます。

DetailsView コントロールに FirstName データと LastName データを表示するために使用される BoundField オブジェクトで、ItemStyle プロパティを宣言によって設定する方法を次のコード例に示します。DetailsView コントロールの AutoGenerateRows プロパティは false に設定されており、SelectCommand プロパティから返されたデータのサブセットを表示できます。
<%@ page language="VB" %> <html> <body> <form runat="server"> <asp:sqldatasource id="SqlDataSource1" runat="server" connectionstring="<%$ ConnectionStrings:MyNorthwind%>" selectcommand="Select * From Employees"> </asp:sqldatasource> <asp:detailsview id="DetailsView1" runat="server" allowpaging="True" datasourceid="SqlDataSource1" height="208px" width="264px" autogeneraterows="False"> <fields> <asp:boundfield sortexpression="LastName" datafield="LastName" headertext="LastName"> <itemstyle backcolor="Yellow"> </itemstyle> </asp:boundfield> <asp:boundfield sortexpression="FirstName" datafield="FirstName" headertext="FirstName"> <itemstyle forecolor="#C00000"> </itemstyle> </asp:boundfield> <asp:buttonfield text="TestButton" buttontype="Button"> </asp:buttonfield> </fields> </asp:detailsview> </form> </body> </html>
<%@ page language="C#" %> <html> <body> <form runat="server"> <asp:sqldatasource id="SqlDataSource1" runat="server" connectionstring="<%$ ConnectionStrings:MyNorthwind%>" selectcommand="Select * From Employees"> </asp:sqldatasource> <asp:detailsview id="DetailsView1" runat="server" allowpaging="True" datasourceid="SqlDataSource1" height="208px" width="264px" autogeneraterows="False"> <fields> <asp:boundfield sortexpression="LastName" datafield="LastName" headertext="LastName"> <itemstyle backcolor="Yellow"> </itemstyle> </asp:boundfield> <asp:boundfield sortexpression="FirstName" datafield="FirstName" headertext="FirstName"> <itemstyle forecolor="#C00000"> </itemstyle> </asp:boundfield> <asp:buttonfield text="TestButton" buttontype="Button"> </asp:buttonfield> </fields> </asp:detailsview> </form> </body> </html>
<%@ page language="VJ#" %> <html> <body> <form runat="server"> <asp:sqldatasource id="SqlDataSource1" runat="server" connectionstring="Data Source=localhost;Integrated Security=SSPI;Initial Catalog=Northwind;" selectcommand="Select * From Employees"> </asp:sqldatasource> <asp:detailsview id="DetailsView1" runat="server" allowpaging="True" datasourceid="SqlDataSource1" height="208px" width="264px" autogeneraterows="False"> <fields> <asp:boundfield sortexpression="LastName" datafield="LastName" headertext="LastName"> <itemstyle backcolor="Yellow"> </itemstyle> </asp:boundfield> <asp:boundfield sortexpression="FirstName" datafield="FirstName" headertext="FirstName"> <itemstyle forecolor="#C00000"> </itemstyle> </asp:boundfield> <asp:buttonfield text="TestButton" buttontype="Button"> </asp:buttonfield> </fields> </asp:detailsview> </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.ItemStyle プロパティを検索する場合は、下記のリンクをクリックしてください。

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