Home All Groups Group Topic Archive Search About
Author
28 Mar 2005 4:35 PM
Brad
Why would this not work?
//
Private Sub nNext_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles nNext.Click
    dgTopTen.CurrentPageIndex += 1
    dgTopTen.DataBind()
End Sub
\\

I get this error message here: Invalid CurrentPageIndex value. It must be >=
0 and < the PageCount

I have also tried something like this:
//
Private Sub dgHistory_PageIndexChanged(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.DataGridPageChangedEventArgs) Handles
dgHistory.PageIndexChanged
dgTopTen.CurrentPageIndex = e.NewPageIndex
dgTopTen.DataBind()
End Sub
\\

With this one my first 5 records are still shown.

I am all new to this so I appreciate and thank you for the help in what I am
missing.

Brad

Author
28 Mar 2005 6:19 PM
Elton Wang
Hi Brad,

In order to page, you need re-bind datagrid's data source:

dgTopTen.CurrentPageIndex = e.NewPageIndex
dgTopTen.DataSource = GetDataSource ' Get data source from
Session or db
dgTopTen.DataBind()

HTH

Elton Wang
elton_w***@hotmail.com


>-----Original Message-----
>Why would this not work?
>//
>Private Sub nNext_Click(ByVal sender As System.Object,
ByVal e As
>System.EventArgs) Handles nNext.Click
>    dgTopTen.CurrentPageIndex += 1
>    dgTopTen.DataBind()
>End Sub
>\\
>
>I get this error message here: Invalid CurrentPageIndex
value. It must be >=
>0 and < the PageCount
>
>I have also tried something like this:
>//
>Private Sub dgHistory_PageIndexChanged(ByVal sender As
Object, ByVal e As
>System.Web.UI.WebControls.DataGridPageChangedEventArgs)
Handles
>dgHistory.PageIndexChanged
>dgTopTen.CurrentPageIndex = e.NewPageIndex
>dgTopTen.DataBind()
>End Sub
>\\
>
>With this one my first 5 records are still shown.
>
>I am all new to this so I appreciate and thank you for
the help in what I am
Show quoteHide quote
>missing.
>
>Brad
>
>
>
>.
>

Bookmark and Share