我在 asp.net 的 .aspx 页面中遇到了不同的符号
<%#eval(expr) %>
<%#bind(expr) %>
<% %> - for specifying the c# code in aspx page
<%$ %> - for specifying the SQL connection string in <asp:SqlDataSource>
这些符号背后是否有任何潜在的逻辑,或者只是我们必须盲目记住的语法? <% %> 一般意味着什么?
最佳答案
这只是语法。
<% %>
是 <script runat="server"> </script>
的缩写又名 code render blocks .
<%# %>
是binding expressions (加上上面的内容)。
<%= %>
就是上面的 + a Response.Write()
.
<%: %>
就是上面的 + a Response.Write()
包裹在 Html.Encode
(.NET 4.0 中的新增功能)。
<%$ %>
是 ASP.NET expression ,用于在运行时绑定(bind)配置或资源文件数据。
关于asp.net - asp.net .aspx页面中各种符号的含义,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5833278/