问题
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