Thursday, March 29, 2012

Performance question

I have one question.
DataGrid control is performance cost.Use any other control if possible. That
is by the book.
But I need sorting and paging on all my pages.
So, is there any better solution or I should use dataGrid anyway?
Thank you,
SimonSimon,
Suppose we have 100 thousand records in a datagrid, you
just click next page of data grid and it go get those
100 thousand records again, bind them, and take you
to next page.
what we did we cached datatable in an application object,
and bound it with data grid, and refreshed application object
on every insert/update/delete.
heres some code I used to load datatable for the first time,
or if it is already loaded, use from cache:
If context.Application("dvInvoices") Is Nothing Then
Dim dtTemp As DataTable = daoDgrCache.InvoicesSelectAll '// get
datatable from database
context.Application.Lock()
context.Application("dtInvoices") = dtTemp '// caches invoices datatable
context.Application.UnLock()
End If
datagrid1.DataSource = CType(context.Application("dtInvoices"),
DataTable).Copy.DefaultView
and on invoice record insert/update/delete, I called a proc
to refresh cache by doing this:
Dim dtTemp As DataTable = daoDgrCache.InvoicesSelectAll '// get datatable
from database
context.Application.Lock()
context.Application("dtInvoices") = dtTemp '// caches invoices datatable
context.Application.UnLock()
You can also use per-session caching and file caching.
--
Hope this helps,
Zeeshan Mustafa, MCSD
"simon" <simon.zupan@.stud-moderna.si> wrote in message
news:ez5bylCWEHA.1380@.TK2MSFTNGP12.phx.gbl...
> I have one question.
> DataGrid control is performance cost.Use any other control if possible.
That
> is by the book.
> But I need sorting and paging on all my pages.
> So, is there any better solution or I should use dataGrid anyway?
> Thank you,
> Simon
>
I don't see any issues using the DataGrid. How many rows are we talking
about in your case. You should also take intto consideration the method
of creating tables in class ASP compared to the performance of compiled
code and also the time taken to implement the features like sorting,
paging, in-line editing etc. The extra money that you can save I feel
that you can invest in your hardware.
Regards,
Trevor Benedict R
MCSD
*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!
If you came up with your own solution, chances are, it wouldn't have a much
smaller footprint, but the downside would be that it was proprietary, and
therefore, more expensive in the short and long run. I would stick with the
DataGrid.
HTH,
Kevin Spencer
.Net Developer
Microsoft MVP
Big things are made up
of lots of little things.
"simon" <simon.zupan@.stud-moderna.si> wrote in message
news:ez5bylCWEHA.1380@.TK2MSFTNGP12.phx.gbl...
> I have one question.
> DataGrid control is performance cost.Use any other control if possible.
That
> is by the book.
> But I need sorting and paging on all my pages.
> So, is there any better solution or I should use dataGrid anyway?
> Thank you,
> Simon
>

0 comments:

Post a Comment