Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference Between <%: and <%= [duplicate]

Tags:

syntax

asp.net

Possible Duplicate:
ASP.NET “special” tags

I hope this isn't too much of a newbie question. I seem to always use the correct syntax, but I don't really understand why I'm using the <%: and <%= in ASP.NET, and I was hoping someone could clarify for me. I found this article which explains <%= and <%#, but wasn't able to find anything in Google on <%:.

Examples of where I have used the various syntax:

<div>
  <%: Html.LabelFor(model => model.Type) %>
  <%: Html.TextBoxFor(model => model.Type)%>
</div>

and

<div id="header-menu">
  <ul>
    <li><%= Html.ActionLink("Home", "", "Home" )%></li>
  </ul>
</div>

Thanks for any clarification.

Possible Answer (per ChrisF): ASP.NET "special" tags

like image 720
JasCav Avatar asked Dec 12 '25 18:12

JasCav


1 Answers

<%: "some string" %>

is equal to:

<%= Html.Encode("some string") %>
like image 168
šljaker Avatar answered Dec 16 '25 21:12

šljaker



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!