Last post Jan 04, 2007 02:36 AM by GeorgeZ
Dec 28, 2006 12:16 PM|vindicator|LINK
With something I'm doing, I had enabled trace and found in the Control List tree that there are a whole bunch of, what appear to be, separating LiteralControls that are not even rendered in the actual page.
I looked at the value of them as they contain bytes which are CR, LF and a bunch of spaces (asc(22)).
Can anyone explain their existence in the rendering process and what is different about them that prevent them from being rendered?
Dec 29, 2006 10:39 PM|vindicator|LINK
Ok, I'm thinking those literals are actually rendered and in the source, though they do not have any tags and thus no clientid.
It's just writing a crlf and a tab-effect to make the source readable. That's my guess.
Jan 03, 2007 04:04 AM|GeorgeZ|LINK
Jan 03, 2007 04:14 AM|vindicator|LINK
Do you think there is an easy way to identify what controls being rendered contain a client id at the page level?
I'm thinking it would only be seen at the control's rendering level.
Jan 04, 2007 02:36 AM|GeorgeZ|LINK
Yes. it is better to turn ASP.NET tracing off first since it will geneartes two much HTML code.
1. I create a simple form(or empty), using browser to get the resulted HTML code.
2. Get the new version of html code after add following to code behind.
protected void Page_Load(object sender, EventArgs e)
foreach (Control ctl in Controls)
if (ctl is System.Web.UI.LiteralControl)
((System.Web.UI.LiteralControl)ctl).Text = "Hello";
it will change all of the LiteralControl Text property to "Hello";
So then these LiteralControl are replace with "Hello" in HTML source code.
Compare the two version of HTML source, then you can get the ideal what those Literal Controls really are!