<% %> in ASP.NET (embedded code blocks)

后端 未结 5 1349
醉话见心
醉话见心 2021-01-30 13:57

I understand what these signify in the markup of the aspx pages ... but I don\'t not know the full power they can be used for or even the name to denote these special directives

5条回答
  •  挽巷
    挽巷 (楼主)
    2021-01-30 14:31

    Here (or here - in case it moves again) is a post I found and stashed away some time ago listing all the different inline server-side tags with examples. There are seven:

    1. <%...%> runs normal code
    2. <%=...%> is equivalent to Response.Write()
    3. <%#...%> is used for databinding expressions
    4. <%$...%> returns the value of an expression, and can be used in parameters (note: expressions are not code - see here)
    5. <%@...%> is for page directives, usually at the top of the ASPX file
    6. <%--...--%> is for comments
    7. <%:...%> is the same as <%= except it HTML-encodes the value

提交回复
热议问题