Visual Basic Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsProgrammingVisual Basic Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old January 18th, 2006, 03:25 AM
karenlim karenlim is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jan 2006
Posts: 7 karenlim User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 35 m 50 sec
Reputation Power: 0
Datagrid paging

hie, can someone pls help me with the problem i faced with the datagrid paging ?

the msg error occur when i click on the second page of the datagrid ....
the msg error is Invalid CurrentPageIndex value. It must be >= 0 and < the PageCount.

my coding is as below :


Private Sub DataGrid1_PageIndexChanged(ByVal sender As System.Object, ByVal e As System.Web.UI.WebControls.DataGridPageChangedEvent Args) Handles DataGrid1.PageIndexChanged


Dim ds1 As New DataSet
Dim da1 As New SqlClient.SqlDataAdapter("select tblmember.username, tblmember.memberphoto_path, tblpayment.aboutme from tblmember, tblpayment where tblmember.paymentid = tblpayment.paymentid AND tblmember.gender = '" & txtgender.Text & "'", conn)
da1.Fill(ds1)
DataGrid1.CurrentPageIndex = e.NewPageIndex
DataGrid1.DataSource = ds1
DataGrid1.DataBind()


pls kindly assists me on this problem....

thanks...

regards,
karenlim

Reply With Quote
  #2  
Old January 26th, 2006, 06:07 AM
D.O.M.I.N.A.T.O.R's Avatar
D.O.M.I.N.A.T.O.R D.O.M.I.N.A.T.O.R is offline
Kingpin contributor
ASP Free Beginner (1000 - 1499 posts)
 
Join Date: Nov 2005
Location: P.E, RSA
Posts: 1,051 D.O.M.I.N.A.T.O.R User rank is First Lieutenant (10000 - 20000 Reputation Level)D.O.M.I.N.A.T.O.R User rank is First Lieutenant (10000 - 20000 Reputation Level)D.O.M.I.N.A.T.O.R User rank is First Lieutenant (10000 - 20000 Reputation Level)D.O.M.I.N.A.T.O.R User rank is First Lieutenant (10000 - 20000 Reputation Level)D.O.M.I.N.A.T.O.R User rank is First Lieutenant (10000 - 20000 Reputation Level)D.O.M.I.N.A.T.O.R User rank is First Lieutenant (10000 - 20000 Reputation Level)D.O.M.I.N.A.T.O.R User rank is First Lieutenant (10000 - 20000 Reputation Level)D.O.M.I.N.A.T.O.R User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 1 Week 4 Days 2 h 12 m 16 sec
Reputation Power: 201
Quote:
Originally Posted by karenlim
hie, can someone pls help me with the problem i faced with the datagrid paging ?

the msg error occur when i click on the second page of the datagrid ....
the msg error is Invalid CurrentPageIndex value. It must be >= 0 and < the PageCount.

my coding is as below :


Private Sub DataGrid1_PageIndexChanged(ByVal sender As System.Object, ByVal e As System.Web.UI.WebControls.DataGridPageChangedEvent Args) Handles DataGrid1.PageIndexChanged


Dim ds1 As New DataSet
Dim da1 As New SqlClient.SqlDataAdapter("select tblmember.username, tblmember.memberphoto_path, tblpayment.aboutme from tblmember, tblpayment where tblmember.paymentid = tblpayment.paymentid AND tblmember.gender = '" & txtgender.Text & "'", conn)
da1.Fill(ds1)
DataGrid1.CurrentPageIndex = e.NewPageIndex
DataGrid1.DataSource = ds1
DataGrid1.DataBind()


pls kindly assists me on this problem....

thanks...

regards,
karenlim



Difficult to tell your problem when I cant see the rest of the code, but few things to try:

1. When you initially bind your datagrid, if it is in the page load, make sure you have got it between:

Code:
if not page.ispostback then
'bind datagrid
end if


2. Try,

Code:
DataGrid1.CurrentPageIndex = 0
DataGrid1.databind()


when you bind the datagrid initially.

3. Try putting the datagrid's binding all in one procedure, and call it when needed.

If no success, just post the rest of your code!

Hope this helps!
J.

Reply With Quote
Reply

Viewing: ASP Free ForumsProgrammingVisual Basic Programming > Datagrid paging


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

 Free IT White Papers!
 
How to Present Effectively Online
This white paper offers practical and actionable advice on the key steps that any presenter should consider as they plan and execute a Webinar or online meeting.

 
Open Source Security Myths
Open Source Software (OSS) is computer software whose source code is available to the general public with relaxed or non-existent intellectual property restrictions (or arrangement such as the public domain), and is usually developed with the input of many contributors.

 
Power and Cooling Capacity Management for Data Centers
This paper describes the principles for achieving power and cooling capacity management.

 
Scalable, Fault-Tolerant NAS for Oracle - The Next Generation
For several years NAS has been evolving as a storage alternative for Oracle databases, and for good reason: NAS is quite often the simplest, most cost-effective storage approach for Oracle. Learn about the benefits that HP's approach to scalable NAS brings to Oracle environments in this comprehensive white paper.

 
Understanding Web Application Security Challenges
This white paper discusses many common threats and preventive measures for Web application security, and explains what you can do to help protect your organization.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway
Stay green...Green IT