下面是后台程序
        protected void DataList1_ItemCommand(object source, System.Web.UI.WebControls.DataListCommandEventArgs e)
        {
            switch (e.CommandName)
            {                case "edit":
                    DataList1.EditItemIndex = e.Item.ItemIndex;
                    ShowBooks_Bind(); 
                    break;
                case "cancel":
                    DataList1.EditItemIndex = -1;
                    ShowBooks_Bind(); 
                    break;
                case "update":
                    doc.Load(patch);
                    XmlNodeList nodelist = doc.SelectNodes("BookStore/Book[name='" + e.CommandArgument + "']");//e.CommandArgument是前台邦定的固定ID
                    foreach (XmlNode xn in nodelist)
                    {
                        XmlElement xe = (XmlElement)xn;
                        XmlNodeList nls = xe.ChildNodes;
                        foreach (XmlNode xn1 in nls)
                        {
                            XmlElement xe2 = (XmlElement)xn1;
                            if (xe2.Name == "title")
                            {
                                xe2.InnerText = ((TextBox)e.Item.FindControl("tb1")).Text;
                                break;
                            }
                        }
                        break;
                    }
                        doc.Save(patch);
                        DataList1.EditItemIndex = -1;
                        ShowBooks_Bind();
                        break;
                    
            }
        }
下面是XML
<?xml version="1.0" encoding="utf-8"?>
<BookStore>
  <Book>
    <number>20090222175144</number>
    <title>测试1</title>
    <type>SQL数据库</type>
    <author>Test</author>
    <price>58</price>
    <time>200902221751</time>
  </Book>
</BookStore>