代码如下:
更新按钮事件:
private void Btn_update_Click(object sender, System.EventArgs e)
{
Xml_UpDt(ViewState["uid"].ToString());//调用Xml_UpDt方法
BindDG();//重新绑定datagrid
}
{
Xml_UpDt(ViewState["uid"].ToString());//调用Xml_UpDt方法
BindDG();//重新绑定datagrid
}
Xml_UpDt方法:
void Xml_UpDt(string userid)
{
string username = this.Txt_name.Text;
string userpass = this.Txt_pass.Text;
string usermail = this.Txt_mail.Text;
string usersite = this.Txt_site.Text;
string usermsn = this.Txt_msn.Text;
string [] Columns = {"username","userpass","usermail","usersite","usermsn"};
string [] ColumnsValues = {username,userpass,usermail,usersite,usermsn};
OperateXmlByDataSet.UpdateXmlRow(ViewState["filename"].ToString(),Columns,ColumnsValues,"userid",userid);
}
ViewState["filename"]= Server.MapPath("..//XML//User.xml");{
string username = this.Txt_name.Text;
string userpass = this.Txt_pass.Text;
string usermail = this.Txt_mail.Text;
string usersite = this.Txt_site.Text;
string usermsn = this.Txt_msn.Text;
string [] Columns = {"username","userpass","usermail","usersite","usermsn"};
string [] ColumnsValues = {username,userpass,usermail,usersite,usermsn};
OperateXmlByDataSet.UpdateXmlRow(ViewState["filename"].ToString(),Columns,ColumnsValues,"userid",userid);
}
OperateXmlByDataSet的UpdateXmlRow方法:
UpdateXmlRow