Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

web.config settings

Status
Not open for further replies.

malinimv

Programmer
Dec 12, 2006
3
US
Hi,

I have a form with couple of drop-down lists. I want to put the values of the drop-down lists in the web.config file so that the values can be changed later. How do I do this ?

Any help is appreciated.



Thanks

 
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<add key="ddlValue" value="thisandthat" />
<add key="ddlValue2 value="thisandmore" />
</appSettings>
</configuration>

Page_Load()
{
if (!Page.IsPostBack)
{
string appVal1 = ConfigurationSettings.AppSettings["ddlValue"].ToString();
string appVal2 = ConfigurationSettings.AppSettings["ddlValue2"].ToString();
ddl1.items.insert(0,new ListItem("Select Me",appVal1);
ddl1.items.insert(1,new ListItem("Select Me 2",appVal2);
}
}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top