473,322 Members | 1,405 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,322 software developers and data experts.

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 16392
You need to use the ReturnValue of the ObjectDataSourceStatusEventArgs or
SqlDataSourceStatusEventArgs 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******@newsgroups.nospam> wrote in message
news:EE**********************************@microsof t.com...
You need to use the ReturnValue of the ObjectDataSourceStatusEventArgs or
SqlDataSourceStatusEventArgs 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******@newsgroups.nospam> wrote in message
news:EE**********************************@microsof t.com...
You need to use the ReturnValue of the ObjectDataSourceStatusEventArgs or
SqlDataSourceStatusEventArgs 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
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...
5
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...
10
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
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...
8
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...
2
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...
4
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. ...
3
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...
7
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...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
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...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
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...

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.