开发者

What is the difference between the various "<% %>" items [duplicate]

开发者 https://www.devze.com 2023-01-24 04:51 出处:网络
This question already has answers here: 开发者_运维知识库 Closed 12 years ago. Possible Duplicates:
This question already has answers here: 开发者_运维知识库 Closed 12 years ago.

Possible Duplicates:

When should I use # and = in ASP.NET controls?

What is the difference between <% %> and <%=%>?

I have seen samples with "<%#", "<%=" and "<%". First of all, is there a name for these things? Second, where can I find a reference that tells what the different versions do? I have tried searching, but can't find anything.


Check out the differences at (there are some you missed and I'm not going to re-key all the information when it's already referenced elsewhere):

Inline ASP.NET Tags...Sorting Them All Out


They're commonly referred to as "bee stings".

What is the difference between <% %> and <%=%>?


The difference between <% %> and <%= %> is discussed here. In essence the <%= %> variant is used used to output the result of an expression, while the version without the = is just used to execute some code.

The <%# %> version is used for data binding, and its use is discussed on this Microsoft support page.

The official name for this syntax is Server-Side Scripting Delimiters. Much more info can be found in the answers to question 649428.


Here is a handy little article that I found:

http://naspinski.net/post/inline-aspnet-tags-sorting-them-all-out-(3c25242c-3c253d2c-3c252c-3c252c-etc).aspx

0

精彩评论

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