protected void Button3_Click(object sender, EventArgs e)
{
XmlElement bo = xdoc.CreateElement("book");
XmlElement au = xdoc.CreateElement("author");
XmlElement pu = xdoc.CreateElement("publisher");
XmlElement na = xdoc.CreateElement("name");
XmlElement pr = xdoc.CreateElement("price");
XmlElement isb = xdoc.CreateElement("isbn");
XmlElement da = xdoc.CreateElement("date");
xdoc.AppendChild(au);
xdoc.AppendChild(bo);
xdoc.AppendChild(pu);
xdoc.AppendChild(na);
xdoc.AppendChild(pr);
xdoc.AppendChild(isb);
xdoc.AppendChild(da);
xdoc.Save(Server.MapPath("newbook2.xml"));
this.ClientScript.RegisterClientScriptBlock(this.GetType(),"kk","<script type='text/javascript'>alter</script>");
}
protected void Button2_Click(object sender, EventArgs e)
{
XmlNode node = xdoc.DocumentElement.SelectSingleNode("book[name='" + this.DropDownList1.Text + "']");
node.SelectSingleNode("author").InnerText = this.TextBox1.Text;
node.SelectSingleNode("publisher").InnerText = this.TextBox2.Text;
node.SelectSingleNode("date").InnerText = this.TextBox3.Text;
node.SelectSingleNode("isbn").InnerText = this.TextBox4.Text;
node.SelectSingleNode("price").InnerText = this.TextBox5.Text;
xdoc.Save(Server.MapPath("books.xml"));
// Page.RegisterClientScriptBlock("key1","<script type='text/javascript'>alter</script >");
this.ClientScript.RegisterClientScriptBlock(this.GetType(),"key2","<script type='text/javascript'>alter</script >");
}
protected void Button4_Click(object sender, EventArgs e)
{
XmlNode node = xdoc.DocumentElement.SelectSingleNode("book[name='"+this.DropDownList1.Text+"']");
xdoc.DocumentElement.RemoveChild(node);
this.DropDownList1.Items.RemoveAt(this.DropDownList1.SelectedIndex);
xdoc.Save(Server.MapPath("newbook.xml"));
}
}