how to Embedded Code Blocks in ASP.NET Web Pages?

后端 未结 2 1484
予麋鹿
予麋鹿 2020-12-17 21:26

where we use <%@ %> <%= %> <%# %> etc. what else asp tags can be added in asp.net web pages?

相关标签:
2条回答
  • 2020-12-17 21:52
    <%@ %> - page directives, Register control
    <%= %> - for the server code  
    <%# %> - for the eval kind of function its also for the server code
    
    0 讨论(0)
  • 2020-12-17 22:08

    <%%> is short hand for:

    <script runat="server">
    </script>
    

    Anyting inside the <% and %> is server side code.

    The other variants are also shortcuts:

    • <%@%> is a page directrive
    • <%=%> is short for Response.Write
    • <%:%> is short for Response.Write, adding html encoding (introduced with .NET 4.0)
    • <%#%> is a binding expression

    This page is a good reference to all these.

    0 讨论(0)
提交回复
热议问题