protected void saveinfo_Click(object sender, EventArgs e) { string configPath = Page.Server.MapPath("../xml/user_" + this.userid + ".config"); XmlDocumentExtender doc = new XmlDocumentExtender(); if (System.IO.File.Exists(configPath)) { if (doc.SelectSingleNode("/UserConfig/ShowInfo") == null) { XmlNode userconfig = doc.CreateElement("UserConfig"); doc.AppendChild(userconfig); XmlNode showinfo = doc.CreateElement("ShowInfo"); showinfo.InnerText = showhelp.SelectedValue.ToString(); userconfig.AppendChild(showinfo); } else { XmlNode showinfo = doc.SelectSingleNode("/UserConfig/ShowInfo"); showinfo.InnerText = showhelp.SelectedValue.ToString(); } } else { XmlElement userconfig = doc.CreateElement("UserConfig"); XmlElement showinfo = doc.CreateElement("ShowInfo"); showinfo.InnerText = showhelp.SelectedValue.ToString(); userconfig.AppendChild(showinfo); doc.AppendChild(userconfig); } doc.Save(configPath); this.RegisterStartupScript("PAGE", "window.location='likesetting.aspx'"); }
protected void saveinfo_Click(object sender, EventArgs e) { string configPath = Page.Server.MapPath("../xml/user_" + this.userid + ".config"); if (File.Exists(configPath)) { File.Delete(configPath); } XmlDocumentExtender doc = new XmlDocumentExtender(); XmlElement userconfig = doc.CreateElement("UserConfig"); XmlElement showinfo = doc.CreateElement("ShowInfo"); showinfo.InnerText = showhelp.SelectedValue.ToString(); userconfig.AppendChild(showinfo); doc.AppendChild(userconfig); XmlElement showupgradenode = doc.CreateElement("ShowUpgrade"); showupgradenode.InnerText = showupgrade.SelectedValue.ToString(); userconfig.AppendChild(showupgradenode); doc.Save(configPath); this.RegisterStartupScript("PAGE", "window.location='likesetting.aspx'"); }
protected void saveinfo_Click(object sender, EventArgs e) { string text = this.Page.Server.MapPath("../xml/user_" + this.userid + ".config"); if (File.Exists(text)) { File.Delete(text); } XmlDocumentExtender xmlDocumentExtender = new XmlDocumentExtender(); XmlElement xmlElement = xmlDocumentExtender.CreateElement("UserConfig"); XmlElement xmlElement2 = xmlDocumentExtender.CreateElement("ShowInfo"); xmlElement2.InnerText = this.showhelp.SelectedValue.ToString(); xmlElement.AppendChild(xmlElement2); xmlDocumentExtender.AppendChild(xmlElement); XmlElement xmlElement3 = xmlDocumentExtender.CreateElement("ShowUpgrade"); xmlElement3.InnerText = this.showupgrade.SelectedValue.ToString(); xmlElement.AppendChild(xmlElement3); xmlDocumentExtender.Save(text); base.RegisterStartupScript("PAGE", "window.location='likesetting.aspx'"); }