472,146 Members | 1,401 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,146 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 2982
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 discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Sean Sims | last post: by
3 posts views Thread by Mike P | last post: by
reply views Thread by Kyle K. | last post: by
2 posts views Thread by Blasting Cap | last post: by
6 posts views Thread by =?Utf-8?B?UGF1bA==?= | last post: by
reply views Thread by Saiars | last post: by
reply views Thread by leo001 | last post: by

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.