Control.IsLiteralContent Method
Determines if the server control holds only literal content.
Assembly: System.Web (in System.Web.dll)
'Declaration Protected Function IsLiteralContent As Boolean 'Usage Dim returnValue As Boolean returnValue = Me.IsLiteralContent()
Return Value
Type: System.Booleantrue if the server control contains solely literal content; otherwise false.
The following example checks whether the page that contains the server controls has posted back. If it has, it calls the IsLiteralContent method to determine whether the control contains just literal content, or is a parent control to other server controls. If it contains solely literal content, the UniqueID property of the LiteralControl that represents that content is written to the response.
' 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
Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98
The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.