如何在ASP.net控件中设置属性的值?假设我的控制是:
<asp:Label runat="Server" ID="Label1" Text="Value"></asp:Label>我想从web.config获取Value:
System.Configuration.ConfigurationManeger.AppSetting["ValueKey"]我必须做什么?
请原谅我的英语水平很差。
发布于 2013-02-08 20:28:50
试试这个-
<asp:Label ID="Label1" runat="server" Text='<%$ AppSettings:SettingKey%>'></asp:Label>其中SettingKey是应用程序设置的密钥名称。
发布于 2013-02-08 19:10:13
试一下-
文本: Label1.Text = System.Configuration.ConfigurationManager.AppSettings"ValueKey".ToString()
VB: Label1.Text = System.Configuration.ConfigurationManager.AppSettings("ValueKey").ToString()
发布于 2013-02-08 19:18:02
向页面加载添加代码,如下所示:
protected void Page_Load(object sender, EventArgs e)
{
Label1.Text = System.Configuration.ConfigurationManager.AppSettings["ValueKey"].ToString();
}https://stackoverflow.com/questions/14771133
复制相似问题