//取消编辑
if (e.CancelMode == ListViewCancelMode.CancelingEdit)
{
//e.Cancel = true;
lvDepartment.EditIndex = -1;
BindData();
HttpContext.Current.Response.Redirect(HttpContext.Current.Request.Url.AbsolutePath);
}
else if (e.CancelMode == ListViewCancelMode.CancelingInsert)
{
BindData();
HttpContext.Current.Response.Redirect(HttpContext.Current.Request.Url.AbsolutePath);
return;
}
if (e.CancelMode == ListViewCancelMode.CancelingEdit)
{
//e.Cancel = true;
lvDepartment.EditIndex = -1;
BindData();
HttpContext.Current.Response.Redirect(HttpContext.Current.Request.Url.AbsolutePath);
}
else if (e.CancelMode == ListViewCancelMode.CancelingInsert)
{
BindData();
HttpContext.Current.Response.Redirect(HttpContext.Current.Request.Url.AbsolutePath);
return;
}
protected void ListView_ItemCanceling(object sender, ListViewCancelEventArgs e)
{
if (e.CancelMode == ListViewCancelMode.CancelingEdit)
{
ListView1.EditIndex = -1;
BindData();
}
else if(e.CancelMode == ListViewCancelMode.CancelingInsert)
{
ListView1.InsertItemPosition = InsertItemPosition.None;
BindData();
}
}