C# 我在编辑配置文件部分有一个详细视图。用户应该能够编辑其配置文件并保存更改

C# 我在编辑配置文件部分有一个详细视图。用户应该能够编辑其配置文件并保存更改,c#,asp.net,C#,Asp.net,我能够在详细信息视图中显示数据。当我单击“编辑”时,它允许我进行编辑,但当我单击“保存”时,它不会得到更新。请参考下面我的代码。用户只能更改手机、地址和电子邮件 protected void UserDetailsView_ItemUpdating(object sender, DetailsViewUpdateEventArgs e) { TextBox mobile = (TextBox)UserDetailsView.Rows[4].Cells[1].Controls[0];

我能够在详细信息视图中显示数据。当我单击“编辑”时,它允许我进行编辑,但当我单击“保存”时,它不会得到更新。请参考下面我的代码。用户只能更改手机、地址和电子邮件

protected void UserDetailsView_ItemUpdating(object sender, DetailsViewUpdateEventArgs e)
{

    TextBox mobile = (TextBox)UserDetailsView.Rows[4].Cells[1].Controls[0];
    TextBox email = (TextBox)UserDetailsView.Rows[5].Cells[1].Controls[0];
    TextBox address = (TextBox)UserDetailsView.Rows[6].Cells[1].Controls[0]; //as TextBox;

    CurrentUser.Employee.MobileNo = mobile.Text;
    CurrentUser.Employee.Email = email.Text;
    CurrentUser.Employee.Address = address.Text;

    DataBaseManager.UpdateEmployee(CurrentUser.Employee);

    UserDetailsView.ChangeMode(DetailsViewMode.ReadOnly);

    UserDetailsView.DataBind();
}

是否成功地在数据库中记录更新?如果我没弄错的话,您需要从数据库中获取数据并再次绑定它。调试代码时有错误吗?没有错误。只是数据没有得到更新。我还有一个绑定函数,我调用pageload.for地址,它将“System.Web.UI.WebControls.TextBox”保存在数据库中。