示例#1
0
        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'");
        }