Solved

Gridview.rows.count ASP.NET 2.0

Posted on 2007-12-05
6
6,053 Views
Last Modified: 2013-11-07
Ok, I have Gridview.Rows.Count to count my results. The problem is this: I have paging enabled... Where only the first 20 results are displayed per page. So there's possibly 8 pages of data (160-180) results but it only displays it found "20 results" for a textbox I have set up. How do I fix this? Thanks, Chris.
0
Comment
Question by:jumpstart0321
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
6 Comments
 
LVL 7

Expert Comment

by:nisarkhan
ID: 20413699
ds.Tables(0).Rows.Count
0
 
LVL 7

Expert Comment

by:nisarkhan
ID: 20413713
if you need all records then 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/aspnet20/dropdownlist_gridview/default.aspx


try this.

// If your datasource is DataSet

DataSet ds=new DataSet();

ds=GetRecords(); // Retrieveing records from database

lblRecords.Text=ds.Tables[0].Rows.Count; // this is your label displaying total records
Gridview1.DataSource=ds;

Gridview1.DataBind();


0
 

Author Comment

by:jumpstart0321
ID: 20413840
Ok, here's what I have:
A Gridview1 on my Default.aspx and a
SqlDataSource1 using a dataset.
All of this being made in the gui with an exception to the SQLDataSource Select query.
Considering the dataset isn't specifically declared in code, how do I reference the dataset if I never even gave it a name?
I have the gridview automatically populated on the Page_load event by declaring the select statement based on whatever is in the QueryString results.
I don't want to re-call the SELECT statement, because I would then have double the processing time which I can't afford. Thanks, Chris.
0
Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

 
LVL 7

Expert Comment

by:nisarkhan
ID: 20414166
here is answer that you are looking for ..

http://fredrik.nsquared2.com/viewpost.aspx?PostID=336
0
 
LVL 7

Accepted Solution

by:
nisarkhan earned 500 total points
ID: 20414179
if the above did not help you then you can have this

If sqldatasource.datasourcemode=dataset then

        Dim dr As Object
        dr = SqlDataSource1.Select(New System.Web.UI.DataSourceSelectArguments)
        MsgBox(dr.count)

But if datasourcemode=datareader, then the only way to find out is to scroll to the eof.
0
 

Author Closing Comment

by:jumpstart0321
ID: 31412920
Thanks man, it was hell:)
0

Featured Post

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

717 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question