C# 使用数据源编辑DetailsView的特定列

C# 使用数据源编辑DetailsView的特定列,c#,asp.net,C#,Asp.net,我有每个员工的详细信息。当用户选择编辑配置文件时,detailsview显示其所有详细信息。现在我想能够编辑只有特定的列,如手机,电子邮件和地址 我已经将数据绑定到detailsview,并已使用Mupdating事件来处理已编辑的数据。它没有给我任何错误,但它没有更新数据。请告诉我哪里出了问题 protected void UserDetailsView_ItemUpdating(object sender, DetailsViewUpdateEventArgs e) {

我有每个员工的详细信息。当用户选择编辑配置文件时,detailsview显示其所有详细信息。现在我想能够编辑只有特定的列,如手机,电子邮件和地址

我已经将数据绑定到detailsview,并已使用Mupdating事件来处理已编辑的数据。它没有给我任何错误,但它没有更新数据。请告诉我哪里出了问题

 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();                     
        }

您正在调用
UserDetailsView.DataBind()UserDetailsView.DataSource=someCollection
``private void Bind(){DataTable dt=DataBaseManager.GetEmployeeDataTable();UserDetailsView.DataSourceID=null;UserDetailsView.DataSource=dt;UserDetailsView.DataBind();}你能说得更具体些吗?你是说它没有在数据库中更新,还是没有更新HTML?同样,当你调试时,你看到了什么?我得到的印象是,您对正在处理的代码不太熟悉,我认为实际调试并查看正在发生的事情会对您有所帮助。您需要“进入”DataBaseManager.UpdateEmployee(CurrentUser.Employee)并查看它为什么不更新。调试时可能会收到错误消息,这些消息可以在原始消息中发布到此处。调试文档帮助:---请实际调试。如果不这样做,你将永远无法学会自己识别和解决问题。StackOverflow是一个很好的资源,可以帮助您修复解决方案,但它不是一个为您完成所有工作的地方。