By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,588 Members | 1,937 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,588 IT Pros & Developers. It's quick & easy.

How do I know the number of rows in a Gridview?

P: n/a
I have a gridview and I need to know the number of rows in it. I find
the Page_load and the Gridview_Load events are too early to find out
the number of rows. I can use the Gridview_databound event to check
for the number of rows. But the problem is that the user can update a
field on my form, which reduces the number of rows in the gridview,
because the gridview SELECT statement no longer finds the records when
their flag has been set to False.
For instance, if my gridview shows all people who were enrolled in a
college, and the user sets a flag that on the form that means one of
the people in the gridview is no longer enrolled, the gridview should
shrink by one row. I need to know when the gridview shrinks to zero
rows, and I don't know what gridview event I can use to tell me that.
Thanks,
Marvin
Jun 27 '08 #1
Share this Question
Share on Google+
1 Reply


P: n/a
On 9 May, 16:51, COHENMAR...@lycos.com wrote:
I have a gridview and I need to know the number of rows in it. *I find
the Page_load and the Gridview_Load events are too early to find out
the number of rows. *I can use the Gridview_databound event to check
for the number of rows. *But the problem is that the user can update a
field on my form, which reduces the number of rows in the gridview,
because the gridview SELECT statement no longer finds the records when
their flag has been set to False.
For instance, if my gridview shows all people who were enrolled in a
college, and the user sets a flag that on the form that means one of
the people in the gridview is no longer enrolled, the gridview should
shrink by one row. *I need to know when the gridview shrinks to zero
rows, and I don't know what gridview event I can use to tell me that.
Thanks,
Marvin
Interrogating the GridView control to discover the number of people
enrolled at any instant is not the best way. Use a database query so
you get the real up-to-date picture independently of the state of the
GridView.

Jun 27 '08 #2

This discussion thread is closed

Replies have been disabled for this discussion.