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

傳回

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. 某些瀏覽器可能會截斷或損毀符號,例如問號 (? ) 、& 符號 ( # A0) 、斜線 mark (/) 和空格,因此某些瀏覽器可能會截斷或損毀這些字元,因此這些字元必須在 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.

HtmlDecodeLiterals方法是在剖析期間由 ASP.NET 網頁架構呼叫,而不是直接在您的程式碼中呼叫。The HtmlDecodeLiterals method is called by the ASP.NET page framework during parsing and is not intended to be called directly in you code.

適用於