After deleting the row from the table:
MyDataGrid.SelectedIndex = MyDataGrid.SelectedIndex - 1
MyDatGrid.PageIndex = CType( Math.Ceiling( MyDataGrid.SelectedIndex / NumRowsPerPage ), "Int32" ) - 1
That should select the right page for you. You may need to add a special check for page 0 (the first page) or selectedindex 0 (the first row), and one for an empty table (the last row was deleted) where you don't have any selected index.
Main Topics
Browse All Topics





by: ahmedrashidPosted on 2004-09-07 at 21:38:33ID: 12003328
Hi
la.com/art icles/0910 03-1.aspx spnet101/a spnet/code sample.asp x? code=pag ing laws/archi ve/2003/02 /28/3222.a spx library/de fault.asp? url=/libra ry/ en-us/v bcon/html/ vbtskSpeci fyingPagin gBehaviorI nDataGridW ebControl. asp
See if these help. The 3rd URL looks promising.
http://aspnet.4guysfromrol
http://www.aspnet101.com/a
http://weblogs.asp.net/rmc
http://msdn.microsoft.com/