By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
458,107 Members | 1,216 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 458,107 IT Pros & Developers. It's quick & easy.

Accessing SQL Server from a usercontrol

P: n/a
When a user control access SQL Server, what happens if I host it multiple
times on one webpage (create several instances of that user control), in
terms of trips being made to the server? How can I make sure a page calls
the server only once, and gets all information required by all user
controls? This applies to a case where user controls are not even the same,
that is, multiple user controls that each access the database using a
different SQL statement/etc.

Thank you,
Sammy
Nov 19 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
The Page_Load of your aspx page should execute before the Page_Load of any
of your usercontrols. I would think that you can do your database work
there, populate some objects, and then pass those to the UserControls to
update them.

Just make sure to create some properties (which accept the object) or
methods (which accept the object or individual params) in your UserControl,
and have them call a UserControl-internal Render () method that updates the
UC's UI.

/// M
"Sammy" <sa***@picostation.com> wrote in message
news:uE**************@TK2MSFTNGP15.phx.gbl...
When a user control access SQL Server, what happens if I host it multiple
times on one webpage (create several instances of that user control), in
terms of trips being made to the server? How can I make sure a page calls
the server only once, and gets all information required by all user
controls? This applies to a case where user controls are not even the same, that is, multiple user controls that each access the database using a
different SQL statement/etc.

Thank you,
Sammy

Nov 19 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.