HtmlTextWriter.GetStyleName メソッド
アセンブリ: System.Web (system.web.dll 内)

Dim styleKey As HtmlTextWriterStyle Dim returnValue As String returnValue = Me.GetStyleName(styleKey)
戻り値
styleKey で指定された HtmlTextWriterStyle 列挙値に関連付けられたスタイル属性名。


<label> 要素を出力するかどうかをチェックする方法を次のコード例に示します。出力する場合は、Color スタイル属性が要素で定義されているかどうかをチェックします。属性が定義されていない場合は、AddStyleAttribute メソッドが呼び出され、GetStyleName メソッドが Color 列挙体メンバを文字列形式に変換し、AddStyleAttribute メソッドに渡します。
' If the markup element being rendered is a Label, ' render the opening tag of a Font element before it. If tagKey = HtmlTextWriterTag.Label Then ' Check whether a Color style attribute is ' included on the Label. If not, use the ' AddStyleAttribute and GetStyleName methods to add one ' and set its value to red. If Not IsStyleAttributeDefined(HtmlTextWriterStyle.Color) Then AddStyleAttribute(GetStyleName(HtmlTextWriterStyle.Color), "red") End If
// If the markup element being rendered is a Label, // render the opening tag of a Font element before it. if (tagKey == HtmlTextWriterTag.Label) { // Check whether a Color style attribute is // included on the Label. If not, use the // AddStyleAttribute and GetStyleName methods to add one // and set its value to red. if (!IsStyleAttributeDefined(HtmlTextWriterStyle.Color)) { AddStyleAttribute(GetStyleName(HtmlTextWriterStyle.Color), "red"); }
// If the markup element being rendered is a Label, // render the opening tag of a <Font> element before it. if ( tagKey == HtmlTextWriterTag::Label ) { // Check whether a Color style attribute is // included on the Label. If not, use the // AddStyleAttribute and GetStyleName methods to add one // and set its value to red. if ( !IsStyleAttributeDefined( HtmlTextWriterStyle::Color ) ) { AddStyleAttribute( GetStyleName( HtmlTextWriterStyle::Color ), "red" ); }
// If the markup element being rendered is a Label, // render the opening tag of a Font element before it. if (tagKey.Equals(HtmlTextWriterTag.Label)) { // Check whether a Color style attribute is // included on the Label. If not, use the // AddStyleAttribute and GetStyleName methods to add one // and set its value to red. if (!(IsStyleAttributeDefined(HtmlTextWriterStyle.Color))) { AddStyleAttribute(GetStyleName(HtmlTextWriterStyle.Color), "red"); }

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 によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


HtmlTextWriter クラス
HtmlTextWriter メンバ
System.Web.UI 名前空間
TextWriter
HtmlTextWriterStyle
AddStyleAttribute
Weblioに収録されているすべての辞書からHtmlTextWriter.GetStyleName メソッドを検索する場合は、下記のリンクをクリックしてください。

- HtmlTextWriter.GetStyleName メソッドのページへのリンク