[英]Difference between modes of literal control
What is the difference between the passthrough and Transform modes of literal control? 文字控制的passthrough和Transform模式之间有什么区别?
Could you post an example, too? 你也可以发一个例子吗?
There are different Literal Modes Literal.Mode
有不同的Literal Modes
Literal.Mode
Have a look at this MSDN article http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.literal.mode.aspx 看看这篇MSDN文章http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.literal.mode.aspx
and take a look at this implemented example Use ASP.NET's Literal control to its full potential 并查看这个实现的示例使用ASP.NET的Literal控件充分发挥其潜力
If you decompile System.Web.UI.WebControls.Literal.Render, you get this: 如果你反编译System.Web.UI.WebControls.Literal.Render,你得到这个:
protected internal override void Render(HtmlTextWriter writer)
{
string text = this.Text;
if (text.Length != 0)
{
if (this.Mode != LiteralMode.Encode)
{
writer.Write(text);
}
else
{
HttpUtility.HtmlEncode(text, writer);
}
}
}
This is the same for .NET 2.0 and .NET 4.0. 这与.NET 2.0和.NET 4.0相同。
So whatever the documentation says, there is no difference between Transform (default) and PassThrough. 所以无论文档说什么,Transform(默认)和PassThrough都没有区别。
Please correct me if I'm wrong. 如果我错了,请纠正我。 There are plenty of articles that just repeat the official documentation, but I would like to see a code sample that proves that there is a difference.
有很多文章只是重复官方文档,但我希望看到一个代码示例,证明存在差异。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.