Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > paging problem

Reply
Thread Tools

paging problem

 
 
Brad
Guest
Posts: n/a
 
      03-28-2005
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.DataGridPageChangedEvent Args) 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



 
Reply With Quote
 
 
 
 
Elton Wang
Guest
Posts: n/a
 
      03-28-2005
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
http://www.velocityreviews.com/forums/(E-Mail Removed)


>-----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.DataGridPageChangedEven tArgs)

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

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Combining numeric mode paging and nextPreview paging in datagrid Red ASP .Net 1 03-12-2005 11:41 PM
datagrid paging - customising paging style wh1974 ASP .Net 0 01-12-2005 03:48 PM
DataSet paging vs Datareader paging =?Utf-8?B?UGF0cmljay5PLklnZQ==?= ASP .Net 1 10-08-2004 02:13 PM
Paging Dr. Who, Paging Dr. Who... Father_Sicko@TheOrphanage.com Computer Security 1 07-02-2004 08:59 PM
DataGrid - sorting/paging problem Hajime Kusakabe ASP .Net 2 07-31-2003 05:18 AM



Advertisments