页面上有个lable 控件
后台给lable 赋值this.Label.Text = "<img src='http://www.baidu.com/img/baidu_logo.gif'/>";
运行时页面上出现图标,
哟没办法让页面上出现<img src='http://www.baidu.com/img/baidu_logo.gif'/> ????
------解决方案--------------------------------------------------------
这个不行吧
要这样
this.Label.Text = " >img src='http://www.baidu.com/img/baidu_logo.gif'/<";
------解决方案--------------------------------------------------------
This.Label.Text = Server.HtmlEncode (" <img src='http://www.baidu.com/img/baidu_logo.gif'/>");
刚测试通过
------解决方案--------------------------------------------------------
------解决方案--------------------------------------------------------
- C# code
This.Label.Text = Server.HtmlEncode (" <img src='http://www.baidu.com/img/baidu_logo.gif'/>"); string str=" <img src='http://www.baidu.com/img/baidu_logo.gif'/> ";str=Server.HtmlEncode(str);Response.Write(str);//这就是个 Server.HtmlEncode 的使用