Paging a datagrid

  • Thread starter Thread starter Joris De Groote
  • Start date Start date
J

Joris De Groote

Hi,

I have added paging to my datagrid, and in the code wrote this:
Private Sub dtgZoekResultaten_PageIndexChanged(ByVal source As Object, ByVal
e As System.Web.UI.WebControls.DataGridPageChangedEventArgs) Handles
dtgZoekResultaten.PageIndexChanged
Me.dtgZoekResultaten.CurrentPageIndex = e.NewPageIndex
Me.dtgZoekResultaten.DataBind()
End Sub

Now, when I click on a pagenumber, my datagrid dissapears? Now I want to see
the datagrid...
How can I see it?

Thanks
Joris
 
Look at your entire code tree and how you are loading the original data. If
you are only loading on non postback.

If (Page.IsPostBack = False) Then
... Get data
End If

you have no data. When you intially get the data, slap it in cache,
viewstate or in session (not the best of the three, IMO, but it can work).
Pull it back out when not postback and rebind.

--
Gregory A. Beamer

*************************************************
Think Outside the Box!
*************************************************
 
Back
Top