C#(Asp.net)对XML文件增、删、改、查(基于DOM)

asp.net文件xmlMain.aspx 和people.xml文件在同一目录下

前台html文件

<% @ Page language = " c# " Codebehind = " xmlMain.aspx.cs " AutoEventWireup = " false " Inherits = " xmlDocWeb.WebForm1 " %>
<! DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
< HTML >
< HEAD >
< title > WebForm1 </ title >
< meta name ="GENERATOR" Content ="Microsoft Visual Studio .NET 7.1" >
< meta name ="CODE_LANGUAGE" Content ="C#" >
< meta name ="vs_defaultClientScript" content ="JavaScript" >
< meta name ="vs_targetSchema" content ="http://schemas.microsoft.com/intellisense/ie5" >
</ HEAD >
< body MS_POSITIONING ="GridLayout" style ="FONT-SIZE:10pt" >
< form id ="Form1" method ="post" runat ="server" >
< FONT face ="宋体" >
< asp:DataGrid id ="grd" style ="Z-INDEX: 101; LEFT: 80px; POSITION: absolute; TOP: 40px" runat ="server"
Width
="456px" ></ asp:DataGrid >
< asp:Button id ="btnAttributes" style ="Z-INDEX: 122; LEFT: 352px; POSITION: absolute; TOP: 448px"
runat
="server" Text ="遍历属性" ></ asp:Button >
< asp:Button id ="Button1" style ="Z-INDEX: 121; LEFT: 80px; POSITION: absolute; TOP: 424px" tabIndex ="6"
runat
="server" Text ="修改" ></ asp:Button >
< asp:TextBox id ="txttel2" style ="Z-INDEX: 120; LEFT: 80px; POSITION: absolute; TOP: 384px" tabIndex ="5"
runat
="server" ></ asp:TextBox >
< asp:Label id ="Label7" style ="Z-INDEX: 119; LEFT: 80px; POSITION: absolute; TOP: 360px" runat ="server" > 修改用户电话 </ asp:Label >
< asp:Button id ="btnAdd" style ="Z-INDEX: 118; LEFT: 352px; POSITION: absolute; TOP: 408px" runat ="server"
Text
="添加" ></ asp:Button >
< asp:TextBox id ="txtemail" style ="Z-INDEX: 117; LEFT: 384px; POSITION: absolute; TOP: 368px"
runat
="server" Width ="136px" tabIndex ="11" ></ asp:TextBox >
< asp:TextBox id ="txttel" style ="Z-INDEX: 116; LEFT: 384px; POSITION: absolute; TOP: 336px" runat ="server"
Width
="136px" tabIndex ="10" ></ asp:TextBox >
< asp:TextBox id ="txtaddress" style ="Z-INDEX: 115; LEFT: 384px; POSITION: absolute; TOP: 304px"
runat
="server" Width ="136px" tabIndex ="9" ></ asp:TextBox >
< asp:TextBox id ="txtid" style ="Z-INDEX: 114; LEFT: 384px; POSITION: absolute; TOP: 280px" runat ="server"
Width
="136px" tabIndex ="8" ></ asp:TextBox >
< asp:Label id ="Label6" style ="Z-INDEX: 113; LEFT: 328px; POSITION: absolute; TOP: 368px" runat ="server" > Email </ asp:Label >
< asp:Label id ="Label5" style ="Z-INDEX: 112; LEFT: 328px; POSITION: absolute; TOP: 344px" runat ="server" > TEL </ asp:Label >
< asp:Label id ="Label4" style ="Z-INDEX: 111; LEFT: 320px; POSITION: absolute; TOP: 312px" runat ="server" > ADDRESS </ asp:Label >
< asp:Label id ="Label3" style ="Z-INDEX: 110; LEFT: 320px; POSITION: absolute; TOP: 280px" runat ="server" > ID </ asp:Label >
< asp:TextBox id ="txtName2" style ="Z-INDEX: 109; LEFT: 384px; POSITION: absolute; TOP: 248px"
runat
="server" Width ="136px" tabIndex ="7" ></ asp:TextBox

版权声明:本文为classperson原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。