469,608 Members | 2,632 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,608 developers. It's quick & easy.

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 2912
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 guiromero | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.