The Mode property of Literal control : Literal « ASP.net Controls « ASP.NET Tutorial






PassThrough: Displays the contents of the control without encoding.

Encode:      Displays the contents of the control after HTML encoding the content.

Transform:   Displays the contents of the control after stripping markup that is not supported by the requesting device.


<%@ Page Language="C#" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
    <title>Show Literal Mode</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>

    <asp:Literal
        id="ltlFirst"
        Mode="PassThrough"
        Text="<hr />"
        Runat="server" />

    <br /><br />

    <asp:Literal
        id="ltlSecond"
        Mode="Encode"
        Text="<hr />"
        Runat="server" />

    <br /><br />

    <asp:Literal
        id="ltlThird"
        Mode="Transform"
        Text="<hr />"
        Runat="server" />

    </div>
    </form>
</body>
</html>








3.2.Literal
3.2.1.asp:Literal
3.2.2.Literal Control
3.2.3.The Mode property of Literal control
3.2.4.Use code behind to set value to asp:Literal (VB.net)