PC Review


Reply
Thread Tools Rate Thread

How to access all rows in GridView?

 
 
=?Utf-8?B?c3Jpbml2YXM=?=
Guest
Posts: n/a
 
      25th Jan 2007
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

 
Reply With Quote
 
 
 
 
bpd
Guest
Posts: n/a
 
      25th Jan 2007
How are you binding the data to the gridview - DataSet, DataSource,
ObjectSource, etc.?


On Jan 25, 3:32 pm, srinivas <srini...@discussions.microsoft.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


 
Reply With Quote
 
David Wier
Guest
Posts: n/a
 
      25th Jan 2007
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" <(E-Mail Removed)> wrote in message
news:3BD63587-E83D-453F-951D-(E-Mail Removed)...
> 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
>



 
Reply With Quote
 
=?Utf-8?B?c3Jpbml2YXM=?=
Guest
Posts: n/a
 
      25th Jan 2007
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" <(E-Mail Removed)> wrote in message
> news:3BD63587-E83D-453F-951D-(E-Mail Removed)...
> > 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
> >

>
>
>

 
Reply With Quote
 
=?Utf-8?B?c3Jpbml2YXM=?=
Guest
Posts: n/a
 
      25th Jan 2007
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...@discussions.microsoft.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

>
>

 
Reply With Quote
 
miladhatam@gmail.com
Guest
Posts: n/a
 
      25th Jan 2007
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

 
Reply With Quote
 
=?Utf-8?B?c3Jpbml2YXM=?=
Guest
Posts: n/a
 
      25th Jan 2007
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,DestinationCity 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.After 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.Paging should
be enabled.

Hope this helps you to understand the problem.

Thanks

"(E-Mail Removed)" 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
>
>

 
Reply With Quote
 
bruce barker
Guest
Posts: n/a
 
      26th Jan 2007
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
>

 
Reply With Quote
 
bruce barker
Guest
Posts: n/a
 
      26th Jan 2007
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,DestinationCity 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.After 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.Paging should
> be enabled.
>
> Hope this helps you to understand the problem.
>
> Thanks
>
> "(E-Mail Removed)" 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
>>
>>

 
Reply With Quote
 
miladhatam@gmail.com
Guest
Posts: n/a
 
      26th Jan 2007

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,DestinationCity 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.After 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.Paging should
> be enabled.
>
> Hope this helps you to understand the problem.
>
> Thanks
>
> "(E-Mail Removed)" 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

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
GRIDVIEW: Effecting buttonfields on single gridview rows =?Utf-8?B?TWFya0F1cml0?= Microsoft ASP .NET 0 23rd May 2006 09:11 PM
Gridview returns old value of gridview.rows.count! MC Microsoft ADO .NET 1 26th Apr 2006 02:51 PM
Gridview returns old value of gridview.rows.count! MC Microsoft ASP .NET 1 26th Apr 2006 02:51 PM
Gridview returns old value of gridview.rows.count! MC Microsoft Dot NET 1 26th Apr 2006 02:51 PM
Gridview returns old value of gridview.rows.count! MC Microsoft C# .NET 1 26th Apr 2006 02:51 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:03 PM.