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
I'd probably put them in an XML file instead - rather than trying to put them into the Web.config
If this works for you, I'll post some code to get you there.
Yes. That works better. Can you show me how to do that?
Thanks
First of all, you'll need to get your XML File Setup - Here is how I did mine
<items> <item name="Item 1" value="1" /> <item name="Item 2" value="2" /> <item name="Item 3" value="3" /></items>
Once you have your XML File setup you can move on to the Dropdownlist section
<asp:DropDownList ID="DropDownList1" runat="server" DataSourceID="XmlDataSource1" DataTextField="name" DataValueField="value"> </asp:DropDownList> <asp:XmlDataSource ID="XmlDataSource1" runat="server" DataFile="~/dropdown.xml"> </asp:XmlDataSource>Just modify the DataFile=" " section to point to whatever you've called your XML File
0 comments:
Post a Comment