且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

插入数据后刷新Gridview

更新时间:2023-12-03 13:15:22

public void GridLoad()
{
with grid
.datasource=dataset(or)datatable
.databind()
end with
}
protected void btnDelete_Click(object sender, EventArgs e)
 {
    // Some code here...
    // Code for deleting here...
    this.upGrid1.Update();
gridload()//call 
 }


朋友,

删除后,将触发插入和更新命令,然后您需要重新绑定网格.
如果再次重新绑定网格,它将显示最新记录.

希望它能对您有所帮助,让我知道是否需要更多信息.
Hi friend,

after delete,insert and update command fired then you need to rebind your grid.
if you again rebind your grid it will show latest record.

Hope it will helps you and let me know if you want to more information.


关于gridview_rowdeleting事件和rowupdating事件

绑定您的gridviw.

将gridview绑定代码放在单独的方法中,假设bindGriddata()

然后在行删除和更新事件中调用bindgriddata()方法.
on gridview_rowdeleting event and rowupdating event

bind your gridviw.

put your gridview binding code in a separate method suppose bindGriddata()

then call bindgriddata() method in rowdeleting and updating events.