473,385 Members | 1,602 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Gridview Not showing Data on page change, when pagechangeindex is alrady handaled

hi,
I have a gridview which is showing 10 record per page. I have manually set the Datasource. I have also set the gridView_PageIndexChanging. when running it shows data in first page with all other page numbers. But, when click on 2nd or 3rd page no. it do not shows any data. I have 100 record in table. i want to show 10 records each page, how to solve this problem? please help me.

Expand|Select|Wrap|Line Numbers
  1.    Function fillgvnhpclist()
  2.  
  3.         Dim qrystring As String
  4.  
  5.         qrystring = "select * from sahaj_driver_ order by emp_code,year_mon"
  6.         objcommand = New OdbcCommand(qrystring, objconn)
  7.         objda = New OdbcDataAdapter(objcommand)
  8.         objda.Fill(objdt)
  9.         If objdt.Rows.Count > 0 Then
  10.             GVnhpc1.DataSource = objdt
  11.             GVnhpc1.DataBind()
  12.         End If
  13.         Return 1
  14.     End Function
  15.  
  16.  
  17.     Protected Sub gridView_PageIndexChanging(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewPageEventArgs) Handles GVnhpc1.PageIndexChanging
  18.         GVnhpc1.PageIndex = e.NewPageIndex
  19.         GVnhpc1.DataSource = objdt
  20.         GVnhpc1.DataBind()
  21.     End Sub
  22.  
  23.  Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
  24.         DatabaseConnection()
  25.         Try
  26.             objconn.Open()
  27.            If (Page.IsPostBack) <> True Then
  28.                 fillgvnhpclist()
  29.             End If
  30.         Catch ex As Exception
  31.             If objconn.State = ConnectionState.Open Then
  32.                 objconn.Close()
  33.             End If
  34.         End Try
  35.     End Sub
Feb 27 '13 #1
0 1190

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Terry Mulvany | last post by:
Grettings, Normally I can use Request.RawUrl to get the 'current' page (amongst many other things). But in the case of using a Server.Transfer but the path from the root of the site . So if...
1
by: GS | last post by:
Hi, I have GridView on my page. How do I retrieve items in current page on GridView? It works only with first page but when I click on next page in GridView it's collection of DataKeys for...
0
by: Sridhar | last post by:
Hi, I have a Crystal Report which has two sub reports in it. When I try to view this Crystal Report in my local computer, it is showing data for sub reports also. But when I deploy it to the web...
3
by: Carlos | last post by:
Hi all, I would like to know what is the most efficient way to redirect a gridview containing data to another page. It is kind of confirming an order which just needs to be re-displayed. Can...
2
by: Richard Carpenter | last post by:
I have a four-page tabcontrol with a gridview on each page. I have the primary key column of each gridview set to hidden (visible = false), but it still shows up on all but the first page. Anyone...
3
by: mathewgk80 | last post by:
Hello, I would like to know how to pass values of a gridview to another page when clicking on the link field in a gridview. Please help me. regards, Mathew
1
by: =?iso-8859-1?B?R2VhcvNpZA==?= | last post by:
Strange problem... Have a gridview on a page (within an update panel) for displaying event dates. GridView loads fine first time around with the PageLoad. There are 2 text fields a user can...
3
by: Dave | last post by:
I have an GridView on one page that will open a popup for the selected record. I've been told that there is a way that when the popup record is updated the GridView can be refreshed or Databind. ...
1
by: Latha gavni | last post by:
Hi, I have a gridview which displays all the fields in employee table.when a use selects a row in gridview and clicks the button it redirects to another page where these values are bounded to...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.