asp.net - Binding Programatically Vs. Object Data Source for Performance -


i used bind gridviews, detailviews etc. on page using objectdatasource (unless wasn't possible so). recently, i've started binding contols programatically. find lot cleaner , easier, though may disagree.

binding objectdatasource has advantages , disadvantages, doing programatically.

say bind gridview programatically (e.g. gridview1.datasource = somelist), when change page on gridview, have code this. each time page changes have call gridview1.datasource = somelist again. objectdatasource don't need this. stick somelist object viewstate when change page don't need hit database each , every time.

my question is: how objectdatasource works? store it's data in viewstate , not hit database again unless call .select method? try , best performance out of applications , hit database few times possible don't idea of storing huge list in viewstate. there better way of doing this? caching per user idea (or possible)? shall hit database everytime instead of storing huge list in viewstate? better hit database use viewstate?

does store it's data in viewstate , not hit database again unless call .select method?

no not save data in viewstate. in view state gridview , other similar lists, saves general status, eg sort column, page, total pages, control state, not data.

is caching per user idea

the caching per user on server side not idea except if caching last few minutes or/and data going cache small. if cache per user large amount of data long time going grow especial if user starts read lot of pages, @ end have same problem.

now have show large amount of data come relation of many tables, maybe better cache full relation of tables "one flat table".

shall hit database everytime instead of storing huge list in viewstate?

this depend how fast have design reading of data. me better keep viewstate small, , keep there informations need make actions on page, , not data.


Comments

Popular posts from this blog

android - Spacing between the stars of a rating bar? -

aspxgridview - Devexpress grid - header filter does not work if column is initially hidden -

c# - How to execute a particular part of code asynchronously in a class -