Multiple User Controls – Single Database Trip?

  • Thread starter Thread starter Paul Hale
  • Start date Start date
P

Paul Hale

I have a web form that contains an Ajax TabContianer control with six tabs.
Each tab contains a separate user control. Although each user control
provides a unique UI all user controls require access to the same data. Im
populating all tabs on one trip to the server so users can immediately switch
between tabs without server round trips.

At the moment each user control’s code behind hits the database for the same
data meaning I have six separate database hits.

My question is - Is it possible to hit the database once (perhaps from the
aspx page that implements the user controls) and use the data throughout all
the user controls?

I know I could do away with all the user controls and embed the html
directly under each tab but this would make my page very complex and I like
the way I can segment html and code with separate user controls. I could also
hit the database once and store the results in a session or cache but would
prefer not to as the data will be unique for each user so this is probably
not the most efficient way either.
 
Thanks for responding but thats not really what im after. I know about batch
select statements but my question is can I hit the database once and access
this data via multiple user controls without storing the data in cache or
sessions.

I dont think this is possible but thought I would post to confirm.
 
Actually thinking about it I guess I could hit the db, lookup the controls I
need to bind (that are contained within the seperate user controls) and bind
that way.

Think I have just answered my own question.
 
Back
Top