473,406 Members | 2,371 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,406 software developers and data experts.

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_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
1 1826
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Flinky Wisty Pomm | last post by:
Hi all, I've got a really annoying problem that I need to fix sharpish. I've got a GridView derived control which has a templated header and footer. It works wonderfully on the first render but...
4
by: c676228 | last post by:
Hi everyone, I need to write a insruance program which needs to collect multiple people information, The information for each person includes name, email, address, phone, dob etc. The DOB data...
9
by: =?Utf-8?B?c3Jpbml2YXM=?= | last post by:
Hi All, Can anybody please help me, how to access all rows in a grid view if the paging is enabled? If gridview contains 100 rows and pagecount=10, then in the gridview.rows collection, i'm...
11
by: Greg | last post by:
I have a gridview on my form which I have populated using a datareader. What I would like to do is to be able to remove specified records from the gridview, without affecting the source of the...
0
by: mike0870 | last post by:
Hi, I've been at this one for hours and cannot not find any posts of anyone having the same problem. Ther scenario is, I need to fill a drop down box with a value in the grid row to pass to the...
0
by: ganesh22 | last post by:
Hi... Iam using GridView in asp.net(2.0) .My requirement is user can add,update,delete in gridview I written the code for add & update but can u help adding rows in grid view My code: ...
1
by: tucson | last post by:
I have a gridview that has a blank row with 2 input fields: file to upload, and a description of the file. They click Add and a new row is added, Remove and the row is removed. The problem is:...
1
by: zlf | last post by:
For tables with large number of rows, it is difficult to access the rows with high page number due to high volume of data. Currently the user is required to click the "..." link many times to get...
3
by: =?Utf-8?B?UGF1bA==?= | last post by:
Hi I have a gridview with one of the columns as a template column with a button. When the user selects the button is there a way to get the row number in the button_Click event? Another one of...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.