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

DataGrid paging - a question of efficiency

Hi.

I already have a datagrid where I'm using paging. I have a stored procedure
that fills a temp table with 200-500 rows and then sends back 10 records at
the time. When I go to page 2 the SP fills the temp table again and returns
rows 10-19. The temp table is dropped after each call to the SP, so it has
to be created and filled every time the user changes page in the datagrid.
My question is this: Would it be more efficient to return all rows to the
datagrid and set the visibility on each datagriditem instead? After the
datagrid is filled up I could hide all but the 10 first datagrid items, and
when the user changes to page 2 I could set only datagrid items 10-19
visible etc. I have read quite a lot about custom paging, but I have never
read anything about this approach therefore I'm interested in what you
experts have to say. Is it a good idea?

Thanks,

Shawn
Nov 19 '05 #1
6 1783
Why are you re-creating and re-populating the temp table on each page
request? Why not store this data in ViewState or the Cache or some other
medium? The only time you should be going back to the database is on the
first page load unless you want to use custom paging and you are going to
the db on each page call, but only bringing down 1 page worth of data.

"Shawn" <bo********@hotmail.com> wrote in message
news:ew**************@TK2MSFTNGP10.phx.gbl...
Hi.

I already have a datagrid where I'm using paging. I have a stored
procedure
that fills a temp table with 200-500 rows and then sends back 10 records
at
the time. When I go to page 2 the SP fills the temp table again and
returns
rows 10-19. The temp table is dropped after each call to the SP, so it
has
to be created and filled every time the user changes page in the datagrid.
My question is this: Would it be more efficient to return all rows to the
datagrid and set the visibility on each datagriditem instead? After the
datagrid is filled up I could hide all but the 10 first datagrid items,
and
when the user changes to page 2 I could set only datagrid items 10-19
visible etc. I have read quite a lot about custom paging, but I have
never
read anything about this approach therefore I'm interested in what you
experts have to say. Is it a good idea?

Thanks,

Shawn

Nov 19 '05 #2
> Why are you re-creating and re-populating the temp table on each page
request? The temp table is created by my stored procedure. When the stored procedure
has finished all temp tables cerated by that SP are automatically dropped by
sybase.
Why not store this data in ViewState or the Cache or some other
medium? Thats exactly what I'm considering. Return all rows from the SP (not just
10 and 10), fill the datagrid with all of them, but only show 10 rows at the
time. That way all rows would all be stored in ViewState.
The only time you should be going back to the database is on the
first page load unless you want to use custom paging and you are going to
the db on each page call, but only bringing down 1 page worth of data. Didn't you read what I wrote? I am using custom paging. I am returning to
the db (SP) on each page call and bringing back 1 page (10 rows) of data.

Shawn

"Scott M." <s-***@nospam.nospam> wrote in message
news:OD**************@TK2MSFTNGP09.phx.gbl... Why are you re-creating and re-populating the temp table on each page
request? Why not store this data in ViewState or the Cache or some other
medium? The only time you should be going back to the database is on the
first page load unless you want to use custom paging and you are going to
the db on each page call, but only bringing down 1 page worth of data.

"Shawn" <bo********@hotmail.com> wrote in message
news:ew**************@TK2MSFTNGP10.phx.gbl...
Hi.

I already have a datagrid where I'm using paging. I have a stored
procedure
that fills a temp table with 200-500 rows and then sends back 10 records
at
the time. When I go to page 2 the SP fills the temp table again and
returns
rows 10-19. The temp table is dropped after each call to the SP, so it
has
to be created and filled every time the user changes page in the datagrid. My question is this: Would it be more efficient to return all rows to the datagrid and set the visibility on each datagriditem instead? After the
datagrid is filled up I could hide all but the 10 first datagrid items,
and
when the user changes to page 2 I could set only datagrid items 10-19
visible etc. I have read quite a lot about custom paging, but I have
never
read anything about this approach therefore I'm interested in what you
experts have to say. Is it a good idea?

Thanks,

Shawn


Nov 19 '05 #3
Hi Shawn,

creating temp tables is not an ideal solution. You would be better off using
derived tables as compared to temp tables. How about specifying the number of
records to be fetched in the Fill method of the DataAdapter when you change
the page of the datagrid.

HTH.

Kaustav Neogy.

"Shawn" wrote:
Hi.

I already have a datagrid where I'm using paging. I have a stored procedure
that fills a temp table with 200-500 rows and then sends back 10 records at
the time. When I go to page 2 the SP fills the temp table again and returns
rows 10-19. The temp table is dropped after each call to the SP, so it has
to be created and filled every time the user changes page in the datagrid.
My question is this: Would it be more efficient to return all rows to the
datagrid and set the visibility on each datagriditem instead? After the
datagrid is filled up I could hide all but the 10 first datagrid items, and
when the user changes to page 2 I could set only datagrid items 10-19
visible etc. I have read quite a lot about custom paging, but I have never
read anything about this approach therefore I'm interested in what you
experts have to say. Is it a good idea?

Thanks,

Shawn

Nov 19 '05 #4
Hi.
The thing is that I have to use temp tables. There is now way around it.
Don't ask why, just accept it :-)
Anyway, specifying the number of records to be fetched in the fill method of
the dataadapter doesn't change anything. I would still have to return to
the db on each page call.

Shawn
"Kaustav" <Ka*****@discussions.microsoft.com> wrote in message
news:FE**********************************@microsof t.com...
Hi Shawn,

creating temp tables is not an ideal solution. You would be better off using derived tables as compared to temp tables. How about specifying the number of records to be fetched in the Fill method of the DataAdapter when you change the page of the datagrid.

HTH.

Kaustav Neogy.

"Shawn" wrote:
Hi.

I already have a datagrid where I'm using paging. I have a stored procedure that fills a temp table with 200-500 rows and then sends back 10 records at the time. When I go to page 2 the SP fills the temp table again and returns rows 10-19. The temp table is dropped after each call to the SP, so it has to be created and filled every time the user changes page in the datagrid. My question is this: Would it be more efficient to return all rows to the datagrid and set the visibility on each datagriditem instead? After the
datagrid is filled up I could hide all but the 10 first datagrid items, and when the user changes to page 2 I could set only datagrid items 10-19
visible etc. I have read quite a lot about custom paging, but I have never read anything about this approach therefore I'm interested in what you
experts have to say. Is it a good idea?

Thanks,

Shawn

Nov 19 '05 #5
Temp tables, derived tables - on some implementations they all boil
down to the same query plan under the covers.

--
Scott
http://www.OdeToCode.com/blogs/scott/

On Sun, 13 Feb 2005 09:17:02 -0800, "Kaustav"
<Ka*****@discussions.microsoft.com> wrote:
Hi Shawn,

creating temp tables is not an ideal solution. You would be better off using
derived tables as compared to temp tables. How about specifying the number of
records to be fetched in the Fill method of the DataAdapter when you change
the page of the datagrid.

HTH.

Kaustav Neogy.

"Shawn" wrote:
Hi.

I already have a datagrid where I'm using paging. I have a stored procedure
that fills a temp table with 200-500 rows and then sends back 10 records at
the time. When I go to page 2 the SP fills the temp table again and returns
rows 10-19. The temp table is dropped after each call to the SP, so it has
to be created and filled every time the user changes page in the datagrid.
My question is this: Would it be more efficient to return all rows to the
datagrid and set the visibility on each datagriditem instead? After the
datagrid is filled up I could hide all but the 10 first datagrid items, and
when the user changes to page 2 I could set only datagrid items 10-19
visible etc. I have read quite a lot about custom paging, but I have never
read anything about this approach therefore I'm interested in what you
experts have to say. Is it a good idea?

Thanks,

Shawn


Nov 19 '05 #6
I did read what you wrote. My response was basically that you have 3
choices:

1. Bring down a copy of all the data on the first page load and store it
for subsequent page loads. The pro's of this are that you don't go to the
data source on each page call. The con is that you are bringing down all
the records but only displaying some of them.

2. Use custom paging and bring down just the records you intend to show.
The upside is that you use considerably less bandwidth. The downside is
that you have to go to the datasource on each page call.

3. Hybrid of the first 2 choices...Get a copy of all the data on the fist
page load and store it. Subsequent page calls can use custom paging against
this copy of the data to get just the records you are interested in.
Advantages here are that you just make one trip to the original data store
(freeing it up to handle other application requests), you can use page
output caching to reduce server processing as well. Downside is that you
are making a copy of the data and holding it in memory somewhere.

"Shawn" <bo********@hotmail.com> wrote in message
news:Ok**************@TK2MSFTNGP12.phx.gbl...
Why are you re-creating and re-populating the temp table on each page
request?

The temp table is created by my stored procedure. When the stored
procedure
has finished all temp tables cerated by that SP are automatically dropped
by
sybase.
Why not store this data in ViewState or the Cache or some other
medium?

Thats exactly what I'm considering. Return all rows from the SP (not just
10 and 10), fill the datagrid with all of them, but only show 10 rows at
the
time. That way all rows would all be stored in ViewState.
The only time you should be going back to the database is on the
first page load unless you want to use custom paging and you are going to
the db on each page call, but only bringing down 1 page worth of data.

Didn't you read what I wrote? I am using custom paging. I am returning
to
the db (SP) on each page call and bringing back 1 page (10 rows) of data.

Shawn

"Scott M." <s-***@nospam.nospam> wrote in message
news:OD**************@TK2MSFTNGP09.phx.gbl...
Why are you re-creating and re-populating the temp table on each page
request? Why not store this data in ViewState or the Cache or some other
medium? The only time you should be going back to the database is on the
first page load unless you want to use custom paging and you are going to
the db on each page call, but only bringing down 1 page worth of data.

"Shawn" <bo********@hotmail.com> wrote in message
news:ew**************@TK2MSFTNGP10.phx.gbl...
> Hi.
>
> I already have a datagrid where I'm using paging. I have a stored
> procedure
> that fills a temp table with 200-500 rows and then sends back 10
> records
> at
> the time. When I go to page 2 the SP fills the temp table again and
> returns
> rows 10-19. The temp table is dropped after each call to the SP, so it
> has
> to be created and filled every time the user changes page in the datagrid. > My question is this: Would it be more efficient to return all rows to the > datagrid and set the visibility on each datagriditem instead? After
> the
> datagrid is filled up I could hide all but the 10 first datagrid items,
> and
> when the user changes to page 2 I could set only datagrid items 10-19
> visible etc. I have read quite a lot about custom paging, but I have
> never
> read anything about this approach therefore I'm interested in what you
> experts have to say. Is it a good idea?
>
>
>
> Thanks,
>
> Shawn
>
>



Nov 19 '05 #7

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

Similar topics

1
by: iforsyth | last post by:
Have a paging datagrid with a checkbox control in column(0). ViewState is enabled. I check the checkbox in first row of the grid on a page and then the program hits this event: Private Sub...
2
by: RJN | last post by:
Hi Sorry for posting again. I have a datagrid which is put inside a div tag to make it scrollable. I need to page the datagrid. The page numbers appear at the bottom of the datagrid and has...
2
by: Daniel Walzenbach | last post by:
Hi, I have a question regarding the DataGrid control. If paging is enabled the grid binds the data, sets the paging on the top/bottom (or however it is set up) and throws away unnecessary...
0
by: wh1974 | last post by:
I've found several posts on the question that I'm about to ask but have found that all link to a page on a website requiring a subscription. The problem I'm having is that in the paging row of a...
3
by: Danky | last post by:
Hello Masters! Anyone can help me with the datagrid, well, the app load a lot of data from DB and it show on the datagrid, and well, I need to allow paging and.... the issue is with the event...
5
by: tshad | last post by:
Is there a way to carry data that I have already read from the datagrid from page to page? I am looking at my Datagrid that I page through and when the user says get the next page, I have to go...
3
by: Pat | last post by:
I have a 2 nested Datagrid. When i select a row in the Master Datagrid i populate the Child databrid using myDataGrid.SelectedIndex value as the filter and setting the DataKeyField. I enabled...
3
by: Fao, Sean | last post by:
I have a DataGrid that I'm adding CheckBox controls to at runtime (in the code behind) and I'm not sure if I'm doing it correctly. First of all, I noticed that the MyDataGrid.Columns.Add() method...
3
by: GD | last post by:
Got a simple ASPX page (.NET v1.1) with a DataGrid displaying a list of widgets. If the page has a QueryString called WidgetId specific, I need to automatically mark the specific DataGridItem as...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.