asp.net读取资源文件的另一种用法

 表达式语法格式: <%$ ... %>
  它是ASP.NET2.0新增了一种声明性表达式语法,可在分析页之前将值替换到页中.
  ASP.NET表达式是基于运行时计算的信息设置控件属性的一种声明性方式.
  ASP.NET表达式主要应用在:连接字符串,应用程序设置,资源文件等地方.
 
  ASP.NET 表达式的基本语法如下:
  <%$ expressionPrefix: expressionValue %>

    <asp:SqlDataSource ID="SDSDevice" runat="server" ConnectionString="<%$ ConnectionStrings:idmtdevConn %>"
        DeleteCommand="DELETE FROM [device] WHERE [id] = @id " 
        SelectCommand="usp_deviceSelect" SelectCommandType="StoredProcedure" >
        <SelectParameters>
            <asp:ControlParameter ControlID="DdlType" Name="typeid" PropertyName="SelectedValue" Type="Int32" />
            <asp:ControlParameter ControlID="DdlSepModel" Name="modelid" PropertyName="SelectedValue" Type="Int32" />
            <asp:ControlParameter ControlID="DdlProvider" Name="providerid" PropertyName="SelectedValue" Type="Int32" />
            <asp:ControlParameter ControlID="DdlLocation" Name="locationid" PropertyName="SelectedValue" Type="Int32" />
            <asp:ControlParameter ControlID="TbKeyword" Name="keyword" PropertyName="Text" Type="String" DefaultValue="*" />           
        </SelectParameters>      
    </asp:SqlDataSource>

 

 

--Web.config--

 <connectionStrings>
  <add name="idmtdevConn" connectionString="Data Source=192.168.168.16;Initial Catalog=idmtdev;Persist Security Info=True;User ID=EWAUser;Password=hk#$G#324f;Application Name=idmtdevDeveloper" providerName="System.Data.SqlClient"/>
  <add name="LocalPolicyStore" connectionString="msxml://c://Inetpub//RolesData//IDMT.EntApp.xml"/>
 </connectionStrings>

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章