What is the difference between the passthrough and Transform modes of literal control?
Could you post an example, too?
What is the difference between the passthrough and Transform modes of literal control?
Could you post an example, too?
There are different 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
and take a look at this implemented example Use ASP.NET's Literal control to its full potential
If you decompile System.Web.UI.WebControls.Literal.Render, you get this:
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.
So whatever the documentation says, there is no difference between Transform (default) and 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.