HtmlTextWriter.IsStyleAttributeDefined 메서드

정의

다음에 RenderBeginTag 메서드를 호출하는 동안 태그 스타일 특성이 렌더링되는지 여부를 결정합니다.

오버로드

IsStyleAttributeDefined(HtmlTextWriterStyle)

다음에 RenderBeginTag 메서드를 호출하는 동안 지정된 태그 스타일 특성이 렌더링되는지 여부를 결정합니다.

IsStyleAttributeDefined(HtmlTextWriterStyle, String)

다음에 RenderBeginTag 메서드를 호출하는 동안 지정된 태그 스타일 특성과 그 값이 렌더링되는지 여부를 결정합니다.

IsStyleAttributeDefined(HtmlTextWriterStyle)

다음에 RenderBeginTag 메서드를 호출하는 동안 지정된 태그 스타일 특성이 렌더링되는지 여부를 결정합니다.

protected:
 bool IsStyleAttributeDefined(System::Web::UI::HtmlTextWriterStyle key);
protected bool IsStyleAttributeDefined (System.Web.UI.HtmlTextWriterStyle key);
member this.IsStyleAttributeDefined : System.Web.UI.HtmlTextWriterStyle -> bool
Protected Function IsStyleAttributeDefined (key As HtmlTextWriterStyle) As Boolean

매개 변수

key
HtmlTextWriterStyle

특성과 관련된 HtmlTextWriterStyle입니다.

반환

Boolean

다음에 RenderBeginTag 메서드를 호출하는 동안 특성이 렌더링되면 true이고, 그렇지 않으면 false입니다.

예제

다음 코드 예제에서는 요소가 렌더링되는지 여부를 <label> 확인하는 방법을 보여 있습니다. 이 경우 메서드는 IsStyleAttributeDefined 요소에 Color 스타일 특성이 정의되었는지 여부를 확인합니다. 특성이 Color 정의 AddStyleAttribute 되지 않은 경우 메서드는 특성을 정의 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 == 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 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

설명

지정된 스타일 특성으로 렌더링할 값을 얻으려면 메서드의 오버로드를 IsStyleAttributeDefined 사용합니다IsStyleAttributeDefined(HtmlTextWriterStyle, String).

추가 정보

적용 대상

IsStyleAttributeDefined(HtmlTextWriterStyle, String)

다음에 RenderBeginTag 메서드를 호출하는 동안 지정된 태그 스타일 특성과 그 값이 렌더링되는지 여부를 결정합니다.

protected:
 bool IsStyleAttributeDefined(System::Web::UI::HtmlTextWriterStyle key, [Runtime::InteropServices::Out] System::String ^ % value);
protected bool IsStyleAttributeDefined (System.Web.UI.HtmlTextWriterStyle key, out string value);
member this.IsStyleAttributeDefined : System.Web.UI.HtmlTextWriterStyle * string -> bool
Protected Function IsStyleAttributeDefined (key As HtmlTextWriterStyle, ByRef value As String) As Boolean

매개 변수

key
HtmlTextWriterStyle

특성과 관련된 HtmlTextWriterStyle입니다.

value
String

스타일 특성에 할당되는 값입니다.

반환

Boolean

다음에 RenderBeginTag 메서드를 호출하는 동안 특성과 그 값이 렌더링되면 true이고, 그렇지 않으면 false입니다.

설명

메서드가 IsStyleAttributeDefined 반환 true되면 특성에 할당 HtmlTextWriterStyle 할 값이 매개 변수에 value 반환됩니다.

추가 정보

적용 대상