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 问题”,并将其取代为新的反馈系统。 有关详细信息,请参阅:提交和查看相关反馈