我在我的asp.net web应用程序中使用详细信息视图。DetailsView事件事件(更新删除)与相同的处理程序
当它触发其更新和插入的事件时,我想以相同的方式处理它们。因为事件参数他们有两个独立的类没有共同的继承我必须有两个基本相同的代码单独的方法。
有没有办法解决这个问题?
例如。
protected void DetailsViewItemInserted(object sender, DetailsViewInsertedEventArgs e)
{
if (e == null)
return;
if (e.Exception != null)
{
e.ExceptionHandled = HandleException(e.Exception);
e.KeepInInsertMode = e.ExceptionHandled;
}
}
protected void DetailsViewItemUpdated(object sender, DetailsViewUpdatedEventArgs e)
{
if (e == null)
return;
if (e.Exception != null)
{
e.ExceptionHandled = HandleException(e.Exception);
e.KeepInEditMode = e.ExceptionHandled;
}
}
我想提取 如果(E == NULL) 回报;
if (e.Exception != null)
{
e.ExceptionHandled = HandleException(e.Exception);
e.KeepInEditMode = e.ExceptionHandled;
}
如果可能,进入某种常用方法。
这真是太棒了这就是我想要的......问题是我们在.net 3.5 :(哦,非常感谢那个亚光 – 2010-07-13 06:33:46