Determina se il controllo server conserva solo il contenuto literal.
Assembly: System.Web (in System.Web.dll)
Protected Function IsLiteralContent As Boolean
protected bool IsLiteralContent()
protected: bool IsLiteralContent()
member IsLiteralContent : unit -> bool
Valore restituito
Tipo: System.Booleantrue se il controllo server contiene solo il contenuto literal; in caso contrario false.
Quando questo metodo restituisce true, l'insieme del controllo server conserva un unico controllo.
Nell'esempio riportato di seguito viene verificato se la pagina contenente i controlli server è stata restituita. In caso affermativo, viene chiamato il metodo IsLiteralContent per determinare se il controllo contiene solo contenuto effettivo o se si tratta di un controllo padre di altri controlli server. Se contiene solo contenuto effettivo, la proprietà UniqueID dell'oggetto LiteralControl che rappresenta quel contenuto viene scritta nella risposta.
' Override the OnLoad method to check if the ' page that uses this control has posted back. ' If so, check whether this controls contains ' only literal content, and if it does, ' it gets the UniqueID property and writes it ' to the page. Otherwise, it writes a message ' that the control contains more than literal content. Overrides Protected Sub OnLoad(ByVal e As EventArgs) If Page.IsPostBack = True Then Dim s As String If Me.IsLiteralContent() = True Then s = Controls(0).UniqueID Context.Response.Write(s) Else Context.Response.Write( _ "The control contains more than literal content.") End If End If End Sub
// Override the OnLoad method to check if the // page that uses this control has posted back. // If so, check whether this controls contains // only literal content, and if it does, // it gets the UniqueID property and writes it // to the page. Otherwise, it writes a message // that the control contains more than literal content. protected override void OnLoad(EventArgs e) { if (Page.IsPostBack) { String s; if (this.IsLiteralContent()) { s = Controls[0].UniqueID; Context.Response.Write(s); } else { Context.Response.Write( "The control contains more than literal content."); } } }
.NET Framework
Supportato in: 4, 3.5, 3.0, 2.0, 1.1, 1.0Windows 7, Windows Vista SP1 o versione successiva, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (componenti di base del server non supportati), Windows Server 2008 R2 (componenti di base del server supportati con SP1 o versione successiva), Windows Server 2003 SP2
.NET Framework non supporta tutte le versioni di ciascuna piattaforma. Per un elenco delle versioni supportate, vedere Requisiti di sistema di .NET Framework.