protected void DetailsView1_ItemInserted(object sender, DetailsViewInsertedEventArgs e)
{
if (e.Exception != null)
{
// System.Windows.Forms.MessageBox.Show(e.Exception.Message);
if (e.Exception.Message.Contains("NULL"))
{
(DetailsView1.FindControl("error") as Label).Text = "内容不能为空!";
}
if (e.Exception.Message.Contains("截断"))
{
(DetailsView1.FindControl("error") as Label).Text = "编号或语言的内容过长!";
}
e.ExceptionHandled = true;
e.KeepInInsertMode = true;
}
}
更新同理!