I'm developing a new ASP.NET MVC 2.0 application and wanting to use the new ASP.NET 4 encoding blocks.
My View code contains <%: Model.ActivityName %>
however Visual Studio is reporting:
Unexpected token
at the position of the :
(colon). When I run the application I get the following compilation error:
Compiler Error Message: CS1525: Invalid expression term ':'
What am i missing?
Cheers for any help/advice.
This feature is new to ASP.Net 4.0, which is in turn new to Visual Studio 2010.
In earlier versions, you should write
<%= Html.Encode(Model.ActivityName) %>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With