protected void DetailsView1_ItemUpdated(object sender, DetailsViewUpdatedEventArgs e)
{
if (e.Exception != null || e.AffectedRows <= 0)
{
ErrorMessageLabel.Text = "在编辑数据时发生错误,请确认所输入之数据的格式是否正确。";
e.ExceptionHandled = true;
}
else
{
ErrorMessageLabel.Text = "已经成功编辑数据...";
}
GridView1.DataBind();
this.UpdatePanel1.Update();
}
protected void GridView1_RowDeleted(object sender, GridViewDeletedEventArgs e)
{
if (e.Exception != null || e.AffectedRows <= 0)
{
ErrorMessageLabel.Text = "因为数据表上拥有外部索引键条件约束,因此无法删除。您只能删除没有关联数据记录的数据记录。";
e.ExceptionHandled = true;
}
else
{
ErrorMessageLabel.Text = "已经成功删除资料...";
}
GridView1.DataBind();
this.UpdatePanel1.Update();
}