复选框值基于webconfig [英] Check Box value based on webconfig
本文介绍了复选框值基于webconfig的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
嗨..,
如何根据asp.net上的webconfig设置Check Box或单选按钮值?
如同一个页面上的2-3复选框一样。基于Web配置,如果第一个复选框值是默认值,则应在页面上检查第一个复选框。
请求帮助....
谢谢..
Hi..,
How to set Check Box or Radio button value based on webconfig on asp.net?
Like 2-3 checkbox is there on one page. Based on web configuration if 1st checkbox value is default then 1st Checkbox should checked on the page.
plese help....
Thanks..
推荐答案
在Web.config中:
In Web.config:
<appSettings>
<add key="defaultCheckBox" value="CPP"/>
</appSettings>
在aspx中:
In aspx:
<asp:CheckBoxList ID="CheckBoxList1" runat="server">
<asp:ListItem>Java</asp:ListItem>
<asp:ListItem>c#</asp:ListItem>
<asp:ListItem>CPP</asp:ListItem>
<asp:ListItem>SQL</asp:ListItem>
</asp:CheckBoxList>
在aspx.cs文件中:
In aspx.cs file:
string defaulCheckBox = System.Configuration.ConfigurationManager.AppSettings["defaultCheckBox"];
CheckBoxList1.SelectedValue = defaulCheckBox;
这篇关于复选框值基于webconfig的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文