Paging a datagrid

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
 
C

Cowboy \(Gregory A. Beamer\)

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!
*************************************************
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,077
Latest member
SangMoor21

Latest Threads

Top