Sunday, April 09, 2006
Searching for the Unsearchable
Boy, this took a long time. A REALLY long time.
I needed to find out a little bit more about a specific tag in ASP.net. Specifically, the '<%' tag. So why not just drop it in a search engine? All the major search engines block searching for this kind of text. It's an incredible pain.
Fortunately, I was lucky enough to find a term that was always associated with this (in this case databinding) that helped me search for it. After browsing through about a million websites, I finally found someone who had the same problem. Let me hand it over to Tone's website.
http://tonesnotes.org/2004/06/16/aspnet-code-block-mystery
It's remarkably hard to search for syntax like "<%=" if you want to find something that speaks about the syntax rather than all the pages that use it.
I ran into a case where apparently identical code blocks in the same .ascx file were being treated differently. One was expanded and the other was treated as a literal.
The problem ended up being that a "runat=server" attribute had been added to the element with the failing code block.
A normal inline ASP.NET code substitution block uses the syntax <%= … %>.
ASP.NET databinding uses the syntax <%# … %>.
<%@ … %> is WebForms syntax. One of the following must follow the @: Page, Control, Import, Implements, Register, Master, MasterType, OutputCache, Reference
<% … %> executes a block of inline code.
<%= … %> does a Response.Write of the value of inline code.
<%# … %> does data-binding
<%$ … %> is used for configuration file substitutions
Thank you Tone!
D
Post a Comment