If your using a DataGrid, you can use the Inbuilt paging.
This will keep track of what the previous and next items are.
private void dg_PageIndexChanged(object source,
System.Web.UI.WebControls.DataGridPageChangedEvent Args e)
{
dg.CurrentPageIndex = e.NewPageIndex;
PopulateGrid(); //this would rebind the grid but the the CurrentPageIndex
set as above
}
Also ensure to set the AllowPaging attribute on your DataGrid to true,
and in your case, set the PageSize to 1
If your using a DataList, i don't believe it has InBuilt paging, and you'll
have to build a custom solution
"SouthSpawn" <so********@aol.com> wrote in message
news:45******************************@localhost.ta lkaboutsoftware.com...
Hello,
I have an asp.net application that will use a SQL Server DBMS for the
backend.
On my asp.net form. I have a next, previous, last and first buttons on my
form.
Basically, this application will allow the user to page through some data
one record at a time.
Let's say my SQL statement returns the following rows with ID's of (1, 3,
5, 9, 10).
What would be the best way that I can always retrieve the previousID and
nextID according to the rows my Select SQL statement returned?
Thanks,
Mark