請問能否用DataGrid顯示Web.config中<appSettings></appSettings>裡面各key的內容?
如果能,又如何讀寫?新增、更改、刪除等...

解决方案 »

  1.   

    http://singlepine.cnblogs.com/archive/2005/12/09/293683.html
      

  2.   

    显示的话 可以直接用
    如你的webconfig 的AppSettings中有行
    <add key="ConnectionString" value="server=192.168.88.111;uid=sa;pwd=123;database=DDD" />ConfigurationSettings.AppSettings["ConnectionString"].ToString();修改 新增 几得 用到
    XmlDocument xdoc = new XmlDocument();
    xdoc.LoadXml(xml);
    XmlNode xNode = xdoc.SelectSingleNode("configuration");
    XmlNode xn = drPeng.SelectSingleNode("AppSettings");
    foreach(XmlNode xnf in xn)
    {
    //xnf.Attributes["key"].Value
    }
      

  3.   

    简单定义个protected 或public 的变量,赋一下值
    string strKey = ConfigurationSettings.AppSettings["Key"]
    在DataGrid里调用一下,不过可能要用到模板列了