开发者

ASP.NET server tag with colon?

I se开发者_JAVA百科arched all around, but could not find any reasonable explanation.

I found <%: tag in one of the projects. It works like the <%= tag.

I could not find any description on this tag I only found that <%: and <%= are the same.

So the question popped out, why could there be two different tags with same functionality? I think there should be some difference.

Could you please clarify it for me.

Thank you


<%: Performs a HTML Encode on the string you are writing out

Scott Hanselman suggests thinking about the equals sign being closed - like a gate (side on view). He talks about it in this video

ASP.NET MVC 2: Ninja Black Belt Tips


<% %> are Embedded Code Blocks

and

<%= %> are used to Display content from web page.

Moreover you can find all the details about ASP.NET Page Syntax from here.

Hope this helps!!


According to this blog post it is a new feature introduced in ASP.NET 4. It is used to automatically HTML Encode the output.

I suggest to read the full blog post, to see how it works ;)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜