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

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • COHENMARVIN@lycos.com

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

    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_databo und 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
  • Stan

    #2
    Re: How do I know the number of rows in a Gridview?

    On 9 May, 16:51, COHENMAR...@lyc os.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_databo und 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.

    Comment

    Working...