473,624 Members | 2,119 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to access all rows in GridView?

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 getting only those 10 rows which are displayed on the screen.
But i want to access all the 100 rows in the code.

Thanks in advance

Jan 25 '07 #1
9 15761
bpd
How are you binding the data to the gridview - DataSet, DataSource,
ObjectSource, etc.?
On Jan 25, 3:32 pm, srinivas <srini...@discu ssions.microsof t.com>
wrote:
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 getting only those 10 rows which are displayed on the screen.
But i want to access all the 100 rows in the code.

Thanks in advance
Jan 25 '07 #2
If you're wanting to access and see all the rows at once, why do you need
paging enabled?
You could always have a button that turns paging on/off - to see all rows,
or not....that is, if you want to go back and forth

--
David Wier
MVP/ASPInsider
http://aspnet101.com
http://aspexpress.com

"srinivas" <sr******@discu ssions.microsof t.comwrote in message
news:3B******** *************** ***********@mic rosoft.com...
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 getting only those 10 rows which are displayed on the
screen.
But i want to access all the 100 rows in the code.

Thanks in advance

Jan 25 '07 #3
Hi David
Thanks for the reply.
I don't want to see all rows at once
Because Paging is a requirement for my application.

One of the gridview column is editable.
I'm having a text box as a template field in that column, where user enters
some numeric value.
After entering the data in all rows user clicks Save button where i want to
save the data of gridview.

Thanks
Srinivas
"David Wier" wrote:
If you're wanting to access and see all the rows at once, why do you need
paging enabled?
You could always have a button that turns paging on/off - to see all rows,
or not....that is, if you want to go back and forth

--
David Wier
MVP/ASPInsider
http://aspnet101.com
http://aspexpress.com

"srinivas" <sr******@discu ssions.microsof t.comwrote in message
news:3B******** *************** ***********@mic rosoft.com...
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 getting only those 10 rows which are displayed on the
screen.
But i want to access all the 100 rows in the code.

Thanks in advance


Jan 25 '07 #4
I'm binding with a datatable.
I have an editable text box field also in the grid view.
while saving, again i need to get all the values entered in the editable
textboxes.

Thanks

"bpd" wrote:
How are you binding the data to the gridview - DataSet, DataSource,
ObjectSource, etc.?
On Jan 25, 3:32 pm, srinivas <srini...@discu ssions.microsof t.com>
wrote:
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 getting only those 10 rows which are displayed on the screen.
But i want to access all the 100 rows in the code.

Thanks in advance

Jan 25 '07 #5
hi
i think you must connect to your database instead of connecting to your
gridview
and insert it to an array
for eg= dataset.Table[0].Rows[i].ItemArray[j].ToString

Jan 25 '07 #6
Hi,
Thanks for the reply.
My problem is in accessing the values of each editable text box within the
grid view.
When the paging is enabled, i'm not able to access all the rows.

I will give you an example here.
I'm having a table with 3 columns OriginCity,Dest inationCity and fare.
Now i have a gridview where i binded all these columns and i have one more
editable column where user can enter number of passengers.Afte r entering the
values if user clicks save i need to calculate the total fare by (fare*no.of
passengers) and store it in DB. So while calculating the total fare i have to
access the gridview rows to get the total number of passengers.Pagi ng should
be enabled.

Hope this helps you to understand the problem.

Thanks

"mi********@gma il.com" wrote:
hi
i think you must connect to your database instead of connecting to your
gridview
and insert it to an array
for eg= dataset.Table[0].Rows[i].ItemArray[j].ToString

Jan 25 '07 #7
they don't exist. the grid is just a window to bound object. you need to
go to the object source to get the other rows.

-- bruce (sqlwork.com)

srinivas wrote:
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 getting only those 10 rows which are displayed on the screen.
But i want to access all the 100 rows in the code.

Thanks in advance
Jan 26 '07 #8
unless you want to send all the table data to the browser in viewstate
(in which case you might as well turn off paging), you need to save the
original table data on the server side.

in your case you should turn off viewstate, save the table in session,
and the page number, then on postback rebind the table to the grid in
oninit.

-- bruce (sqlwork.com)

srinivas wrote:
Hi,
Thanks for the reply.
My problem is in accessing the values of each editable text box within the
grid view.
When the paging is enabled, i'm not able to access all the rows.

I will give you an example here.
I'm having a table with 3 columns OriginCity,Dest inationCity and fare.
Now i have a gridview where i binded all these columns and i have one more
editable column where user can enter number of passengers.Afte r entering the
values if user clicks save i need to calculate the total fare by (fare*no.of
passengers) and store it in DB. So while calculating the total fare i have to
access the gridview rows to get the total number of passengers.Pagi ng should
be enabled.

Hope this helps you to understand the problem.

Thanks

"mi********@gma il.com" wrote:
>hi
i think you must connect to your database instead of connecting to your
gridview
and insert it to an array
for eg= dataset.Table[0].Rows[i].ItemArray[j].ToString

Jan 26 '07 #9

srinivas äæÔÊå ÇÓÊ:
Hi,
Thanks for the reply.
My problem is in accessing the values of each editable text box within the
grid view.
When the paging is enabled, i'm not able to access all the rows.

I will give you an example here.
I'm having a table with 3 columns OriginCity,Dest inationCity and fare.
Now i have a gridview where i binded all these columns and i have one more
editable column where user can enter number of passengers.Afte r entering the
values if user clicks save i need to calculate the total fare by (fare*no..of
passengers) and store it in DB. So while calculating the total fare i have to
access the gridview rows to get the total number of passengers.Pagi ng should
be enabled.

Hope this helps you to understand the problem.

Thanks

"mi********@gma il.com" wrote:
hi
i think you must connect to your database instead of connecting to your
gridview
and insert it to an array
for eg= dataset.Table[0].Rows[i].ItemArray[j].ToString
i think you can use the sql command to do this work
but i have an idea
insert 2 gridviews to page and enable paging of one of them
then assign the visible of the gridview "false" that isnot enabled
paging of it
then you can use the information of gridview 2
ofcourse this way isnot professional
i hope that helps

Jan 26 '07 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
2752
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 then the header/footer vanish into thin air. If I add the header/footer onDataBound then they disappear when I do a postback with no databinding. If I add them during PreRender, then they persist, but one of my data rows is emptied for each time I...
4
4868
by: Tom | last post by:
I need to grab the text from a cell in my gridview and pass it in my querystring I need to do this on the client
0
5940
by: sgtmarcjones | last post by:
How do I access a dropdownlist that is nested within a Formview ItemTemplate Gridview Template? I want to see a label (lgbTimeKeep ! TextValue of ddlName dropdownlist) instead of a dropdownlist in the FormView ItemTemplate Nested Gridview ddlName ItemTemplate. My label is named lgvTimeKeep and the dropdownlist name is ddlName. Thanks!
2
2109
by: Blasting Cap | last post by:
I've got a gridview (that I converted over from a datagrid, which had been working properly), that is doubling up the number of rows returned. When it was running as a datagrid, the same code sent back the proper number of rows. The only thing different I am doing is to display the number of rows returned in the footer of the gridview. The Bindgrid is as follows: Sub BindGrid() Session("reportlevel") = Session("availabilityrptlevel")
0
1112
by: flowk1337 | last post by:
I have a grid view with a datatable as it's datasource in VB. I can successfully import the data into the grid view and see it. I have my website set up so that the user can edit all fields at once and mass update them. So on a button click(fulfill), the program retrieves all rows from the gridview and saves them to a new datatable. I have published this to one server and everything works fine. But when I publish it to another server,...
0
1961
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: <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" CellPadding="3" Height="237px" Style="z-index: 100; left: 155px; position: absolute; top: 132px" Width="688px" BackColor="White" BorderColor="#CCCCCC"...
1
7302
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: When a new row is added, I loop through the existing gridview rows, store the data in a dataset, and rebind. In debug mode, I see the values I entered but when I rebind, it's not displayed in the gridview. Here's the code aspx code: ...
2
5330
by: Michael | last post by:
It seems that a gridview allows us to delete only a single row at a time. How to extend this functionality to select multiple rows and delete all of the selected rows in a single stroke? just like what hotmail web UI is doing now (having the option of selecting multiple rows (using the checkbox provided) and perform a set of operations on them)
1
1841
by: COHENMARVIN | last post by:
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...
0
8234
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8172
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8677
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8620
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8474
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6110
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5563
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
2605
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1482
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.