1、我的treeview控件是从web.sitemap中读取树结构的,但我想根据操作动态更改一些节点的url,该如何实现?请高手帮忙!!!!
2、如何编程才能在web.sitemap插入一个节点值?

解决方案 »

  1.   

    web.sitemap  ?动态操作呀?下面是web.config里的实现   你参考下:
    public void ModifyConfig(string XPath,string key, string strValue) //修改配置
    {
    #region 配置Web.Config文件
    XmlDocument doc = new XmlDocument();
    string Path = Request.PhysicalApplicationPath + "web.config";
    //doc.Load(Server.MapPath("web.config")); doc.Load(Path);
    XmlNode addKey = doc.SelectSingleNode((XPath.Replace("?", key)));
    if (addKey == null)
    {
    //throw new ArgumentException("没有找到<add key='"+key+"' value=.../>的配置节");
    Common.JS("没有找到<add key='" + key + "' value=.../>的配置节");
    return;
    }
    addKey.Attributes["value"].InnerText = strValue;
    doc.Save(Path);
    #endregion
    }