Friends can test it by myself. I have no problem here. I finally solved the problems in the morning.
using system;
using system.collections;
using system.componentmodel;
using system.data;
using system.drawing;
using system.web;
using system.web.sessionState;
using system.web.ui;
using system.web.ui.webcontrols;
using system.web.ui.htmlControls;
using system.xml;
namespace webapplication1
{{
/// <summary>
/// Summary description for webform1.
/// </summary>
public class webform1: system.web.ui.page
{{
Protected system.web.ui.webcontrols.textbox textbox1;
Protected system.web.ui.webcontrols.dropdownList DropdownList1;
Protected system.web.ui.webcontrols.button Button1;
public webform1 ()
{{
pay.init += new system.eventhandler (page_init);
}
Private void page_load (Object Sender, System.eventargs E)
{{
if (! Page.ispostback)
{{
// Open a file (assume that web.config is in the root directory)
string filename = server.mappath (/) + @/web.config;
xmldocumentxmldoc = new xmldocument ();
xmldoc.load (FILENAME);
XMLNODELIST TOPM = xmldoc.documentedLement.childNodes;
Foreach (Xmlelement Element in Topm)
{{
if (Element.name.tology () == AppSettings))
{{
XMLNODELIST_NODE = ELEMENT.CHILDNODES;
if (_Node.count> 0)
{{
DropdownList1.Items.clear ();
Foreach (xmlelement el in _Node)
{{
DropdownList1.Items.add (El.attributes [Key] .innerxml);
}
}
}
}
}
}
Private void page_init (Object Sender, EventArgs E)
{{
initializeComponent ();
}
#Region web form designer generated code
/// <summary>
/// Required Method for Designer Support -Do Not Modify
/// the contents of this method with the code editor.
/// </summary>
Private void InitializeComponent ()
{{
this.Button1.clICK += New System.eventhandler (this.Button1_Click);
this.load += new system.eventhandler (this.page_load);
}
#Endregion
Private void button1_click (Object Sender, System.eventargs E)
{{
string filename = server.mappath (/) + @/web.config;
xmldocumentxmldoc = new xmldocument ();
xmldoc.load (filename);
XMLNODELIST TOPM = xmldoc.documentedLement.childNodes;
Foreach (Xmlelement Element in Topm)
{{
if (Element.name.tology () == AppSettings))
{{
XMLNODELIST_NODE = ELEMENT.CHILDNODES;
if (_Node.count> 0)
{{
Foreach (xmlelement el in _Node)
{{
If (El.attributes [Key] .innerxml.tology () == this.dropdownlist1.selectEdItem.Value.tolower ())
{{
el.attributes [value]. Value = this.textbox1.text;
}
}
}
}
}
xmldoc.save (filename);
}
}
}