ControlBuilder.HtmlDecodeLiterals 方法

定义

确定 HTML 控件的字符串是否必须是 HTML 解码的。Determines whether the literal string of an HTML control must be HTML decoded. 此方法由 ASP.NET 页面框架调用。This method is called by the ASP.NET page framework.

public:
 virtual bool HtmlDecodeLiterals();
public virtual bool HtmlDecodeLiterals ();
abstract member HtmlDecodeLiterals : unit -> bool
override this.HtmlDecodeLiterals : unit -> bool
Public Overridable Function HtmlDecodeLiterals () As Boolean

返回

如果要解码 HTML 控件字符串,则为 true;否则为 falsetrue if the HTML control literal string is to be decoded; otherwise, false.

示例

下面的示例重写 HtmlDecodeLiterals 方法,以允许对应用此生成器的任何控件中的文本字符串进行 HTML 解码。The following example overrides the HtmlDecodeLiterals method to allow HTML decoding of literal strings in any control this builder is applied to.

// Override the HtmlDecodeLiterals method to allow HTML
// decoding of literal strings in any controls this builder
// is applied to.
public override bool HtmlDecodeLiterals()
{
    return true;
}
' Override the HtmlDecodeLiterals method to allow HTML
' decoding of literal strings in any controls this builder
' is applied to.
Public Overrides Function HtmlDecodeLiterals() As Boolean
    Return True
End Function

注解

文本字符串引用 HTML 控件的开始标记和结束标记之间的文本。A literal string refers to the text between the opening and closing tag of an HTML control. 当文本转换为浏览器将显示的字符串表示形式而不是解释为 HTML 时,HTML 编码。HTML encoding is when text is converted into a string representation that the browser will display rather than interpret as HTML. 某些浏览器可能会截断问号(?)、"与" 符号(&)、斜杠标记(/)和空格等字符,因此这些字符必须在 a 标记中或在查询字符串中出现时进行编码。Characters such as the question mark (?), ampersand (&), slash mark (/), and spaces might be truncated or corrupted by some browsers, so those characters must be encoded when they appear in a tags or in query strings.

在分析过程中,ASP.NET 页框架调用 HtmlDecodeLiterals 方法,不应在代码中直接调用。The HtmlDecodeLiterals method is called by the ASP.NET page framework during parsing and is not intended to be called directly in you code.

适用于