HtmlTextWriter.GetTagName(HtmlTextWriterTag) Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
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
Parameters
- tagKey
- HtmlTextWriterTag
The HtmlTextWriterTag to obtain the markup element for.
Returns
A string representing the markup element.
Examples
The following code example demonstrates how to close a <font>
element by using the WriteEndTag method. The 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
Remarks
If tagKey
is not a valid HtmlTextWriterTag value, the GetTagName method returns an empty string ("").
Applies to
See also
意見反應
https://aka.ms/ContentUserFeedback。
即將登場:在 2024 年,我們將逐步淘汰 GitHub 問題作為內容的意見反應機制,並將它取代為新的意見反應系統。 如需詳細資訊,請參閱:提交並檢視相關的意見反應