473,322 Members | 1,425 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.

problems with gridview counting rows

I've got the following code

testlabel.Text = allquestions.Select().Count.ToString();
GridView1.DataSource = allquestions.Select();
GridView1.DataBind();
testlabel.Text = GridView1.Rows.Count.ToString();

allquestions.Select().Count.ToString(); is reporting the correct
value, but GridView1.Rows.Count.ToString(); is reporting the incorrect
value (it is reporting 0)

How do I get GridView1.Rows.Count.ToString(); to report the correct
count?

Jan 29 '07 #1
1 3030
Given that GridView1.Rows.Count.ToString(); is the correct syntax, that
tells me that your allquestions.Select() method is not returning anything
that can be bound, or when subject to a databind has no data. Start looking
there!

Regards

John Timney (MVP)
http://www.johntimney.com
http://www.johntimney.com/blog
"Newmanbt" <br**********@wpafb.af.milwrote in message
news:11*********************@v45g2000cwv.googlegro ups.com...
I've got the following code

testlabel.Text = allquestions.Select().Count.ToString();
GridView1.DataSource = allquestions.Select();
GridView1.DataBind();
testlabel.Text = GridView1.Rows.Count.ToString();

allquestions.Select().Count.ToString(); is reporting the correct
value, but GridView1.Rows.Count.ToString(); is reporting the incorrect
value (it is reporting 0)

How do I get GridView1.Rows.Count.ToString(); to report the correct
count?

Jan 29 '07 #2

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

Similar topics

1
by: Miguel Dias Moura | last post by:
Hello, I have a GridView in my page which is created in runtime. It works fine. My page has 2 Asp Buttons: - The HIDE button makes GridView.Visible = False; - The SHOW button makes...
0
by: Sean Sims | last post by:
recently added a LoginView to an existing page, it now looks like this: <%@ Page Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeFile="AtPress.aspx.cs" Inherits="AtPress"...
3
by: Mike P | last post by:
When I am performing a command on a row in my gridview, it works fine, unless I have paging enabled and I try t execute the command on a page other than the first page. The error I get is 'Index...
0
by: Kyle K. | last post by:
(Note: Windows XP Pro SP2 + Visual Studio .NET 2005 + SQL Server 2000) I have a GridView that is populated with data. That last 2 columns are button fields (image buttons) that have a CommandName...
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...
0
by: sharonrao123 | last post by:
hello all, I have a parent gridview company and in this one a nested gridview people, Is it possible to allow the user to select one row or multiple rows from the people gridview using a check box...
2
by: GISmatters | last post by:
I have unbound checkboxes in a nested gridview to allow multi-selection of "child" rows. For context, the parent gridview rows are for large "reports", the child rows are for various specific files...
0
by: Andy B | last post by:
I have the following gridview. There are 2 other textBoxes and a button on the page as well. When somebody puts text into the 2 textBoxes and presses the add button, it puts the values of those...
6
by: =?Utf-8?B?UGF1bA==?= | last post by:
Hi I have a gridview control with a template column that has a textbox and when the control is bound to the datasource the textbox is filled ok. I then change what is in the textbox in the gridview...
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
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...
1
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: 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...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
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: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

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.