加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > asp.Net > 正文

asp.net <%$...%>语法

发布时间:2020-12-15 18:44:36 所属栏目:asp.Net 来源:网络整理
导读:我正在尝试从Java到.NET的切换。 我注意到一些ASP.NET页面有%$ sometext%在他们中。有人可以在几句话中解释一下这个问题,还是指引一下语法参考? 解决方法 它是表达式构建器语法,它通常用于访问web.config中的设置。以下是使用表达式构建器语法获取连接
我正在尝试从Java到.NET的切换。

我注意到一些ASP.NET页面有<%$ sometext%>在他们中。有人可以在几句话中解释一下这个问题,还是指引一下语法参考?

解决方法

它是表达式构建器语法,它通常用于访问web.config中的设置。以下是使用表达式构建器语法获取连接字符串的示例:
ConnectionString="<%$ ConnectionStrings:sqlconnection %>"

这是一篇很好的文章,解释了所有的内联表达式:
http://support.microsoft.com/kb/976112

The expression builder is used to set values of control properties based on the information that is contained in an application’s configuration or resource files. The following is the basic syntax of the expression builder:
<%$ Expression Prefix: Expression Value %>
The dollar sign ($) indicates to ASP.NET that the following expression is an expression builder. The expression prefix defines the kind of expression,such as AppSettings,ConnectionStrings,or Resources. Additionally,you can create and define your own expression builder. The expression value that follows the colon (:) is what ASP.NET will actually use as the value of a certain property.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读