Gridview doesnt update after the delete command

陌路散爱 提交于 2019-12-25 00:29:40

问题


Basically, I use objectdatasource with gridview.. Everything works, but the gridview, doesnt update as soon as I click the delete button. This forces me to use Server.Transfer on the gridviews events:

protected void GridView1_RowDeleted(object sender, GridViewDeletedEventArgs e)
{
   //Server.Transfer(~/SamePageAsTheGridview);
}

Is there a way for the data to be updated without full post back?


回答1:


After deleting the selected item from your objectsource, Just rebind the data to the gridview after delete.




回答2:


protected void GridView1_RowDeleted(object sender, GridViewDeletedEventArgs e)
{
   GridView1.DataBind();
}


来源:https://stackoverflow.com/questions/6662609/gridview-doesnt-update-after-the-delete-command

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!