473,480 Members | 3,135 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

To check for Gridview PageIndexChanging

20 New Member
Hi!

I am using ASP.NET with VB.In my application,i am using a gridview..My total records in the Database is 50.I am getting values from the database by passing some of the parameters .My O/P contains a total of 7 records.
My page size is 5.When i move to the next page I am getting all the values from the database(50).So my gridview contains total pages as 10.

Can any body help me?
I have used PageIndex changing.
Oct 6 '07 #1
3 3321
rohitbce
30 New Member
hi
try this in pageindex change event of grid

lblMessage.Text = ""
dgBlockDescription.EditIndex = -1
dgBlockDescription.PageIndex = e.NewPageIndex
Bll.clsfrmBlockMasterBll.FillControlWithDs(Me.dgBl ockDescription, Me.dropCityName.SelectedValue)
dgBlockDescription.DataBind()
Oct 6 '07 #2
HariKutty
20 New Member
hi
try this in pageindex change event of grid

lblMessage.Text = ""
dgBlockDescription.EditIndex = -1
dgBlockDescription.PageIndex = e.NewPageIndex
Bll.clsfrmBlockMasterBll.FillControlWithDs(Me.dgBl ockDescription, Me.dropCityName.SelectedValue)
dgBlockDescription.DataBind()


Thanks for your reply
But it is not Working.Can u tell me any other idea please
Oct 11 '07 #3
Plater
7,872 Recognized Expert Expert
What exactly is your problem?
You have a gridview set to only show 5 entries at time, and it hase 10 pages (10 pages * 5 entries at a time = 50 total entries)
What is the problem?
The only thing that really needs to happen in your pageindex changing function is like:
(Where gvCompletedSites is my GridView object)
Expand|Select|Wrap|Line Numbers
  1. protected void gvCompletedSites_PageIndexChanging(object sender, GridViewPageEventArgs e)
  2. {
  3.         gvCompletedSites.PageIndex = e.NewPageIndex;
  4.         gvCompletedSites.DataBind();
  5. }
  6.  
Oct 11 '07 #4

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

Similar topics

2
16319
by: | last post by:
Hello, I have a GridView in my ASP.NET 2.0 application that performs the paging feature perfect when I have it bound to a data source. But now I have it bound to a dataset and the paging...
6
6491
by: Carlos Albert | last post by:
Hi everybody, I'm working with a gridview (4 bound columns and 1 template column, using databind from codebehind). It works just fine, but I tried to add paging, and when I click any paging...
5
3357
by: yefei | last post by:
In my web design, I display records from a SQL DataBase according to some filters the GridView is defined with select commands and selest parameters however, I also want to display all records...
3
2175
by: Marc Grutte | last post by:
Hi I am trying to bind a custom datasource to a gridview whilst paging is enabled. What is missing in this code to make the paging + binding work? thanks M <%@ Page Language="VB" %>
0
1982
by: Don Miller | last post by:
Here is an example of what I believe is a bug in ASP.NET 2.0 GridView paging without postbacks (or at least not documented how to fix it). Once the GridView is displayed, clicking on any of the...
4
2708
by: Don Miller | last post by:
This is a repost of a reproducible problem/bug with GridView with dynamic SQL and binding. Is there a better ASP.NET newsgroup I should post to where MS techs or MVPs take an interest in such...
1
9936
by: Jason Huang | last post by:
Hi, In my C# 2.0 web form project, I have GridView1 in Form1.aspx. I am wondering why I can't find the PageIndexChanging event in the Form1.aspx.cs but the GridView1 still can go to other...
3
10618
by: phpmel | last post by:
Hi Guys, I have a problem. I have a gridview that is bound to a SQLDataSource using a stored procedure that is used for Searching. it works fine. my problem is that if I select a page index, the...
2
2773
shek124
by: shek124 | last post by:
In my form, the gridview is bind , according to my selectedvalue in dropdownlist How can do paging in gridview using the pageindexchanging event for this condition.. please hwlp me
0
6920
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7061
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
6763
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7030
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5367
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4799
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...
0
3015
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3011
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
210
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.