ASP.NET code block mystery <%= vs. <%#
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.
I’m sure there’s a concise statement somewhere about how to escape code blocks and how they can be embedded in layers of quotations. I just haven’t found it yet.
Any pointers out there?