literal控件的例子

Literal的Mode属性,举例说明 这个属性的枚举值:PassThrough  Encode  Transform

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Literal控件.aspx.cs" Inherits="WebApplication1.Literal控件" %>

<!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 runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
       <table border="1" width="600" cellpadding="1" cellspacing="1">
       <tr><td>
       Mode</td><td>
       效果</td></tr>
       <tr><td>
       PassThrough</td><td>
       <asp:Literal ID="Literal1" runat="server" Mode="PassThrough" 
       Text="<abc>http://blog.csdn.net/zhoufoxcn</abc>"></asp:Literal>
       <tr><td>
       Encode</td><td>
       <asp:Literal ID="Literal2" runat="server" Mode="Encode" 
       Text="<abc>http://blog.csdn.net/zhoufoxcn</abc>"></asp:Literal>
       </td></tr>
       <tr><td>
      Transform</td><td>
       <asp:Literal ID="Literal3" runat="server" Mode="Transform"
       Text="<abc>http://blog.csdn.net/zhoufoxcn</abc>"></asp:Literal>
       </td></tr>
       </table>
    </div>
    </form>
</body>
</html>

显示效果图:

在浏览器中查看时PassThrough和Transform效果显示一样,如果用智能设备看的话PassThrough的客户端代码依然是<abc>http://blog.csdn.net/zhoufoxcn</abc>而Transform的代码是http://blog.csdn.net/zhoufoxcn

posted @ 2013-09-25 20:34  笨笨丫头~双  阅读(160)  评论(0编辑  收藏  举报