tags:

views:

160

answers:

4
+2  A: 

Shouldn't that be <% %> or <%= %> for a shorthand of Response.Write?

Here's an MSDN article on Embedded Code Blocks.

ongle
<% %> is straight code to execute, setting variables, loop constructs.<%= %> is the equiv of <% Response.Write(...) %><%: %> is the equiv of <% Response.Write(Html.Encode(...)) %>
DevelopingChris
@DevelopingChris Neat, can't wait to get the upgrade approved. Should be somewhere around 2012.
ongle
+4  A: 

<%: %> starts with .NET v4

For pre-v4 it's equivalent is <%= Html.Encode(...) %>

zerkms
More information here http://haacked.com/archive/2009/09/25/html-encoding-code-nuggets.aspx
R0MANARMY
My mistake. Deleted
Nathan Taylor
A: 

This sometimes happens to me when embedding code inside of html attributes. I've never quite pinned down the exact cause but sometimes you can get around it by using single quotes rather than double.

Luke Lowrey
+4  A: 

The problem was that I was using <%= %> (or even <%: %>) within a tag that had runat="sever".

JamesBrownIsDead