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