HtmlTextWriter.GetTagName(HtmlTextWriterTag) HtmlTextWriter.GetTagName(HtmlTextWriterTag) HtmlTextWriter.GetTagName(HtmlTextWriterTag) HtmlTextWriter.GetTagName(HtmlTextWriterTag) Method

定義

取得與指定 HtmlTextWriterTag 列舉值相關聯的標記項目。Obtains the markup element associated with the specified HtmlTextWriterTag enumeration value.

protected:
 virtual System::String ^ GetTagName(System::Web::UI::HtmlTextWriterTag tagKey);
protected virtual string GetTagName (System.Web.UI.HtmlTextWriterTag tagKey);
abstract member GetTagName : System.Web.UI.HtmlTextWriterTag -> string
override this.GetTagName : System.Web.UI.HtmlTextWriterTag -> string
Protected Overridable Function GetTagName (tagKey As HtmlTextWriterTag) As String

參數

tagKey
HtmlTextWriterTag HtmlTextWriterTag HtmlTextWriterTag HtmlTextWriterTag

要取得的標記項目之 HtmlTextWriterTagThe HtmlTextWriterTag to obtain the markup element for.

傳回

表示標記項目的字串。A string representing the markup element.

範例

下列程式碼範例示範如何<font> WriteEndTag使用方法來關閉元素。The following code example demonstrates how to close a <font> element by using the WriteEndTag method. 方法會呼叫方法,將Font值轉換成字串。 GetTagName WriteEndTagThe WriteEndTag method calls the GetTagName method to convert the Font value to a string.

// Close the Font element.
WriteEndTag( GetTagName( HtmlTextWriterTag::Font ) );
// Close the Font element.
Write(GetTagName(HtmlTextWriterTag.Font));
    ' Close the Font element.
    Me.WriteEndTag(GetTagName(HtmlTextWriterTag.Font))
End If

備註

如果tagKey不是有效HtmlTextWriterTag的值, GetTagName方法會傳回空字串("")。If tagKey is not a valid HtmlTextWriterTag value, the GetTagName method returns an empty string ("").

適用於

另請參閱