Domanda

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?

È stato utile?

Soluzione

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

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top