Question

Using .NET 1.1's DataGrid, I have it populated with lots of links and it is displaying 10 links per page. I have pagination enabled in the footer of the DataGrid. If I go to page 10 in the datagrid, and click on a link in the DataGrid, the correct page loads, but the DataGrid's pagination location goes back to page 1.

How do I keep it at page 10 if the link clicked is on page 10 and so on?

Was it helpful?

Solution

You need to specify witch page you are in. So handle the change page event of your object and do something like the following : (make sure you AllowPaging and DataBind correctly the grid to a DataSource on Page_Load event.)

Private Sub dgSomething_PageIndexChanged(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridPageChangedEventArgs) Handles dgSomething.PageIndexChanged
    Me.dgSomething.CurrentPageIndex = e.NewPageIndex()
    'Then reload data Grid. It will take the next 'pageSize' to display.
End Sub

Hope this helps

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top