Datagrid custom paging always loads page 1

J

Julia B

Hi,

I've got a datagrid where I've set up custom paging, following instructions
in Help etc, however, although the virtualitemcount is correct (i.e. number
of pages shown is correct), whatever page I click on the first 10 dataset
items are always loaded. If anyone can help that would be great! Thanks in
advance....

Code below:

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Me.PartDbConnection.ConnectionString = Global.ConnectionString

'if the page isn't being loaded for the first time update the
datagrid
'with the session dataset
If Me.IsPostBack Then
PartDataSet1 = CType(Session("PartDataSet"), PartDataSet)
'otherwise update the datagrid with the database info
Else
startIndex = 0
PartDataAdapter.Fill(PartDataSet1)
Session("PartDataSet") = PartDataSet1
PartDataGrid.VirtualItemCount = PartDataSet1.Parts.Count
PartDataGrid.DataBind()
End If
End Sub

Private Sub PartDataGrid_PageIndexChanged(ByVal source As Object, ByVal e As
System.Web.UI.WebControls.DataGridPageChangedEventArgs) Handles
PartDataGrid.PageIndexChanged
PartDataGrid.CurrentPageIndex = e.NewPageIndex
PartDataGrid.DataBind()
End Sub

Private Sub PartDataGrid_Page(ByVal sender As Object, ByVal e As
DataGridPageChangedEventArgs)
startIndex = e.NewPageIndex * PartDataGrid.PageSize
PartDataGrid.CurrentPageIndex = e.NewPageIndex
PartDataGrid.DataBind()
End Sub
 
J

Julia B

Thanks Philip

The Help documents I read weren't particularly intuitive or easy to
understand and I didn't find the walkthrough. I'll work through it and see if
I can get it to work.

Julia
 

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,755
Messages
2,569,534
Members
45,008
Latest member
Rahul737

Latest Threads

Top