[英]ASP.Net Listview
I would like to fire the ListView1_ItemUpdating event on ListView1_ItemDeleting. 我想在ListView1_ItemDeleting上触发ListView1_ItemUpdating事件。
Reason is whenever user press delete in listview, the record should not be physically delete from the database. 原因是每当用户在列表视图中按Delete键时,都不应从数据库中物理删除该记录。 There is a bit in table I need to just make it true so need to update that record.
表中有一点我需要使其正确,因此需要更新该记录。
So How could I do this? 那么我该怎么做呢?
Thanks. 谢谢。
Write a common function to Update database and call it in both ListView1_ItemUpdating
and ListView1_ItemDeleting
events . 编写一个公共函数来更新数据库 ,并在
ListView1_ItemUpdating
和ListView1_ItemDeleting
事件中调用它。
Pass entity to be updated to that function , when it is called from ListView1_ItemDeleting
the bit should set true. 从
ListView1_ItemDeleting
调用实体时,将要更新的实体传递给该函数,将位设置为true。
Use this approach maybe useful. 使用此方法可能有用。
void ContactsListView_ItemUpdating(Object sender, ListViewUpdateEventArgs e)
{
Update();
}
protected void CategoriesListView_OnItemDeleting(object sender, ListViewDeleteEventArgs e)
{
Update();
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.