2 DataGrids & Paging

R

rn5a

In a shopping cart app, a ASPX page retrieves the order details &
personal details of a user from a MS-Access database table depending
upon the username of the user.

The order details of a particular order (like ProductID, Name,
Description, Quantity etc.) are displayed in one DataGrid where as the
personal details of the buyer corresponding to this order (like Name,
E-Mail, Shipping & Billing Address etc.) are displayed in another
DataGrid. Note that both the DataGrids reside in the same ASPX page.

Users can also place multiple orders. Under such circumstances, I want
to provide paging capability to the ASPX page that displays the 2
DataGrids. Assume that I have placed 5 orders & currently I am viewing
my 1st order. The 1st DataGrid displays the order details of my 1st
order & the 2nd DataGrid displays personal details corresponding to my
1st order. When I click the 2nd paging link, the 1st DataGrid should
display the order details of my 2nd order & the 2nd DataGrid should
display the personal details corresponding to my 2nd order.

The problem is if I provide paging in the 1st DataGrid & then click
the 2nd paging link to view my 2nd order & personal details, then the
1st DataGrid will correctly display the order details of my 2nd order
but the 2nd DataGrid will not correctly display the personal details
corresponding to my 2nd order.

The situation just reverses if I provide paging in the 2nd DataGrid
i.e. while viewing the details of my 1st order, if I click the 2nd
paging link to v;iew my 2nd order & personal details, then the 2nd
DataGrid will display the personal details of my 2nd order correctly
but the 1st DataGrid will not correctly display the order details
corresponding to my 2nd order.

What do I do in such a scenario?

Of course, I can do the paging manually but that would involve adding
a lot of extra code. I won't be able to use the in-built paging
feature of the DataGrid as well.

Please note that I would like to display the order details & personal
details in 2 different DataGrids only.
 
G

Guest

Hi,
I guess you are using ASP.NET 1.1.
Since you have two grids with same number of records, it won't be difficult.
You can apply paging on 1st or 2nd or both the datagrids.
When ever a user clicks on page number a event is generated. Handle that
event. From there you'll get the NewPageIndex of the datagrid, set the same
index for the second grid also.

I hope this solves your problem. In case of any difficulty or problem feel
free to write back to me.
 
R

rn5a

Hi,
I guess you are using ASP.NET 1.1.
Since you have two grids with same number of records, it won't be difficult.
You can apply paging on 1st or 2nd or both the datagrids.
When ever a user clicks on page number a event is generated. Handle that
event. From there you'll get the NewPageIndex of the datagrid, set the same
index for the second grid also.

I hope this solves your problem. In case of any difficulty or problem feel
free to write back to me.












- Show quoted text -

Thanks Tushar for the idea. Actually I was supposed to use 2 DataGrids
but since I want the 2nd DataGrid to display records row-wise & not
column-wise (have a look at how I want to display the records at
http://rn5a.brinkster.net/Page1.aspx), I had to replace the 2nd
DataGrid with a DetailsView.

Any idea how do I go about paging under such circumstances?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top