XML删除按钮,修改并保存按钮 和 添加按钮。完成这些按钮所对应的功能(XmlDocument)。
2012-12-21 23:50
357 查看
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"));
}
}
{
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"));
}
}
相关文章推荐
- 在昨天作业的基础上添加 :删除按钮,修改并保存按钮 和 添加按钮。完成这些按钮所对应的功能(XmlDocument)。
- 使用XmlDocument将dropdownlist中显示的书名的其它信息读入到相应的文本框中。添加 :删除按钮,修改并保存按钮 和 添加按钮。完成这些按钮所对应的功能(XmlDocument)
- XML中对于一个books.xml的详情显示,删除按钮,修改并保存按钮 和 添加按钮。完成这些按钮所对应的功能(XmlDocument)。
- 在昨天作业的基础上添加 :删除按钮,修改并保存按钮 和 添加按钮。完成这些按钮所对应的功能/新建页面DataXML,使用GridView显示book.xm中的图书信息
- XML---添加 删除、编辑、修改并保存、添加、查找、生成XML按钮并完成对应的功能
- C#使用XmlDocument操作XML进行查询、增加、修改、删除、保存应用的实例(转载)
- C#使用XmlDocument操作XML进行查询、增加、修改、删除、保存应用的实例
- GrideVlew提供点击按钮添加新数据,单击项目修改,长按删除功能
- 使用XmlDocument操作XML进行查询、增加、修改、删除、保存应用的实例(转载)
- 地磅称量系统之(40) 实现称量管理界面上的添加、修改、删除、保存、取消按钮的代码
- C#使用XmlDocument操作XML进行查询、增加、修改、删除、保存应用的实例
- C#使用XmlDocument操作XML进行查询、增加、修改、删除、保存应用的实例
- 这是一个关于XML文档的操作管理器XMLHelper类,类中包括XML文档的创建,文档节点和属性的读取,添加,修改,删除的方法功能的实现
- C#使用XmlDocument操作XML进行查询、增加、修改、删除、保存应用的实例(转载)
- 给ListVlew提供点击按钮添加新数据,单击项目修改,长按删除功能,
- ALV中添加按钮 进行修改、创建、删除、添加、导入、保存等操作
- 利用MFC Document/View框架完成图形显示和保存功能
- iptables防火墙规则的添加、删除、修改、保存
- 为dojo普及做贡献-C--ajax操作是完成了,但把添加、修改等按钮改成右键,再把提交表单改酷点
- 将dataGridView中的添加/删除等修改保存至数据库 ,支持多条操作,最后一次性保存