473,831 Members | 2,227 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

GridView: Total Records

I need to get the total number of items/records returned into GridView.

If I just do myGridView.Rows .Count, then it just returns me the total number
of items on the page.

But if I have, 10 pages (10 records per page) and 98 records total,
Rows.Count will return me 10 on the first 9 pages, and 8, on the last page.

But, I need to somehow get access to total record count which is 98. What
is the proper/easy way to accomplish that?

Thanks,


Mar 30 '06 #1
3 16440
You need to use the ReturnValue of the ObjectDataSourc eStatusEventArg s or
SqlDataSourceSt atusEventArgs while handling the datasource's Selected event.
Look at this sample for the code:
http://www.webswapp.com/codesamples/...w/default.aspx
--
HTH,
Phillip Williams
http://www.societopia.net
http://www.webswapp.com
"Amelyan" wrote:
I need to get the total number of items/records returned into GridView.

If I just do myGridView.Rows .Count, then it just returns me the total number
of items on the page.

But if I have, 10 pages (10 records per page) and 98 records total,
Rows.Count will return me 10 on the first 9 pages, and 8, on the last page.

But, I need to somehow get access to total record count which is 98. What
is the proper/easy way to accomplish that?

Thanks,


Mar 30 '06 #2
Phillip!

Thank you,

I have been looking for the Nested GridView sample (same web site, not the
page you give) for a few weeks now.

I didn't bookmark it, and figured I'd find it later.

Too much info on the internet sometimes.

...

"Phillip Williams" <WE******@newsg roups.nospam> wrote in message
news:EE******** *************** ***********@mic rosoft.com...
You need to use the ReturnValue of the ObjectDataSourc eStatusEventArg s or
SqlDataSourceSt atusEventArgs while handling the datasource's Selected event. Look at this sample for the code:
http://www.webswapp.com/codesamples/...w/default.aspx --
HTH,
Phillip Williams
http://www.societopia.net
http://www.webswapp.com
"Amelyan" wrote:
I need to get the total number of items/records returned into GridView.

If I just do myGridView.Rows .Count, then it just returns me the total number of items on the page.

But if I have, 10 pages (10 records per page) and 98 records total,
Rows.Count will return me 10 on the first 9 pages, and 8, on the last page.
But, I need to somehow get access to total record count which is 98. What is the proper/easy way to accomplish that?

Thanks,


Mar 30 '06 #3
You are welcome.
--
HTH,
Phillip Williams
http://www.societopia.net
http://www.webswapp.com
"sloan" wrote:
Phillip!

Thank you,

I have been looking for the Nested GridView sample (same web site, not the
page you give) for a few weeks now.

I didn't bookmark it, and figured I'd find it later.

Too much info on the internet sometimes.

...

"Phillip Williams" <WE******@newsg roups.nospam> wrote in message
news:EE******** *************** ***********@mic rosoft.com...
You need to use the ReturnValue of the ObjectDataSourc eStatusEventArg s or
SqlDataSourceSt atusEventArgs while handling the datasource's Selected

event.
Look at this sample for the code:

http://www.webswapp.com/codesamples/...w/default.aspx
--
HTH,
Phillip Williams
http://www.societopia.net
http://www.webswapp.com
"Amelyan" wrote:
I need to get the total number of items/records returned into GridView.

If I just do myGridView.Rows .Count, then it just returns me the total number of items on the page.

But if I have, 10 pages (10 records per page) and 98 records total,
Rows.Count will return me 10 on the first 9 pages, and 8, on the last page.
But, I need to somehow get access to total record count which is 98. What is the proper/easy way to accomplish that?

Thanks,



Mar 30 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
1481
by: news.microsoft.com | last post by:
I've looked in the help and at each of the properties for the grid view, but can't seem to find what I need. I have allowpaging set to true for my gridview and when the page loads I go and fetch 75 records from the DB, I know there are 750 records total in the DB. How can I control the paging? I don't want to go and get all 750 records at once then allow the grid view to do the paging. Currently the biggest issue I'm facing is how to...
5
4842
by: Dick | last post by:
I have a GridView bound to an ObjectDataSource. I have a Button that calls GridView.DataBind. I want the row that is selected before the DataBind to still be selected afterwards. This happens automatically if the data doesn't change. But if records have been added or deleted then it looks as if some code is necessary: I've done this by using GridView.SelectedValue to get the key value of the currently selected Row and then by itterating...
10
5315
by: NH | last post by:
I have a girdview with paging enabled. How can I add a message in the footer to say "Viewing records 1-15 of 45" etc Thanks
2
4612
by: msch-prv | last post by:
Hi, I have a paged gridview (Apts_grd) tied to an Access DataSource (Apts_srcGrd). How do I get the total number of data records returned by the query? The following shows only the number of records per page: Apts_srcGrd.SelectCommand = "SELECT * FROM tblApts WHERE ..." Apts_grd.DataBind() Response.Write("Count: " + Apts_grd.Rows.Count.ToString
8
18095
by: Greg Lyles | last post by:
Hi all, I'm trying to develop an ASP.NET 2.0 website and am running into some real problems with what I thought would be a relatively simple thing to do. In a nutshell, I'm stuck on trying to display data in a "GridView" which is tied to an "ObjectDataSource". In turn, this ObjectDatasource gets it's data from a strongly-typed business object within my code.
2
2120
by: Blasting Cap | last post by:
I've got a gridview (that I converted over from a datagrid, which had been working properly), that is doubling up the number of rows returned. When it was running as a datagrid, the same code sent back the proper number of rows. The only thing different I am doing is to display the number of rows returned in the footer of the gridview. The Bindgrid is as follows: Sub BindGrid() Session("reportlevel") = Session("availabilityrptlevel")
4
3939
by: cmrhema | last post by:
hello I am using a gridview to display records. I have set page index for the grid. I have populated the gridview. After every 10 records I will move to the next page. All these works fine. Now I want to place total no. of records in the gridview in a label. I tried to use page count but it gives ambigous result.
3
3352
by: HariKutty | last post by:
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.
7
3340
by: =?Utf-8?B?V2FubmFiZQ==?= | last post by:
Is there a way to use a gridview in a timecard application, and if so, how? I was looking at using a gridview to display a person's hours worked in a week. To do this, many different data records would have to display on the same row to make up a week (the database has a new row for each day entered). But, from what I can tell, this keeps you from being able to use a gridview, because the gridview relies on one datakey per row (and there...
0
10778
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10496
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9319
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7750
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6951
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5622
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5788
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4419
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3077
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.