当前位置: 动力学知识库 > 问答 > 编程问答 >

c# - Setting 'codebehind' properties from within markup on ASP.NET Web Forms

问题描述:

Placing the following code inside the 'markup' section on a web form does not work

Have I messed the syntax up or is something like this not possible on 'server side' controls?

<asp:TextBox runat="server" ID="txt" Text='<%#System.Configuration.ConfigurationManager.AppSettings["foo"] %>' />

网友答案:

Use $ expression.

<asp:TextBox 
       runat="server" 
       ID="txt" 
       Text='<%$ AppSettings: foo %>'
分享给朋友:
您可能感兴趣的文章:
随机阅读: