// Remove method INT currentPage = 0; if (result == 1) // Delete success {if (this.dataGrid1.currentpageIndex == this.DataGrid1.pageCount -1) {if (this.DataGrid1.currentpageIndex == 0 ) {this.DataGrid1.CurrentPageIndex = this.DataGrid1.PageCount -1;} else {if (this.DataGrid1.Items.Count% this.DataGrid1.PageSize == 1) {CurrentPage = 2;} else {CurrentPage = 1; } This.dataGrid1.currentpageindex = this.dataGrid1.pagecount - currentpage;}}
} Else {response.redirect ("error.aspx", true); // delete failed} binddata (); // Re-bound data