DataGrid NOT Paging

T

TCORDON

I have a DataGrid with this properties set:

AllowPaging = True
PagerStyle/Mode = NumericPages

In my form_Load:

If not(me.ispostback) then
' Some code to get the data into DS...
grdItems.DataSource = DS.Tables(0).DefaultView
grdItems.DataBind
endif

It binds the data ok but when i click another page number....nothing happens
it seems it does a PostBack but displays the same records.

TIA
 
S

Scott M.

All you've done is said that you want to "Allow Paging". The DataGrid does
not implement the actual paging functionality automatically, you must write
the paging code yourself.

Public Sub DataGrid1_PageIndexChanged(Sender..., e As ....)....
DataGrid1.CurrentPageIndex = e.NewPageIndex
DataGrid1.DataBind
End Sub
 
S

Scott M.

It's not the onPage event that needs handling, its the PageIndexChanged
event that needs handling.
 
K

kw_uh97

Thanks Scott, I was perusing the boards trying to get my paging problems
answered and ran acroos your post. It worked perfectly.

Oh by the way, I'm guessing here??? I have ordered your book "ASP.NET Data
Web Controls Kick Start" and look forward to learning everything about web
data controls.

Thanks Again,
kw_uh97
 
S

Scott M.

Glad to help. Although, I am not the same Scott M. as the author of the
book you mention.
 

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

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,065
Latest member
OrderGreenAcreCBD

Latest Threads

Top