GridView calculated columns .. best place??

W

wildman

RE: GridView calculated columns .. best place??

I've got this table without about 5000 rows.

I know as rule you should limit the number of rows passed to the grid.
But with sorting and paging options, I'd like to send them all there.

Previously, the datasource was a db view with a few columns that were
derived from a db function. A real performance killer taking 3 minutes
to display the grid.

If I remove the function columns of course the sql comes right back
fast.

I was thinking maybe I perform the calculation as rows are displayed
maybe in the forms prerender codebehind event?

I've done similar code to turn off and on grid buttons based on values
in the row, but have never have limited to only what's in the current
page (what's actually showing).

Good Idea?

How do I even limit to what's being displayed.

Protected Overrides Sub OnPreRender(ByVal e As EventArgs)
For Each dgItem In GridOrders.Rows
Dim CashBackButton As Button =
CType(GridOrders.Rows(dgItem.RowIndex).FindControl("ReturnCash"),
Button)

Any sample code?

Thanks for any help or information.
 
B

bruce barker

turn off viewstate on the grid. then do the bind in oninit. your code will
need to remember the paging and osorting between postbacks. otherwise you are
sending all 5000 rows to client, and its shipping them back, a real
performance killer.


-- bruce (sqlwork.com)
 

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

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,071
Latest member
MetabolicSolutionsKeto

Latest Threads

Top