I have a user control that displays results from a database in a gridview. The containing page receives querystring values and passes them to the user control to load.
From the containing page, what is the best way to load and display the user control? Currently, I do the following:
- Containing Page_Load: Get querystring values
- Containing Page_Load: Instantiate User Control
- Containing Page_Load: set User Control's properties
- Containing Page_Load: Add User Control to Page
I'm not sure what event in the user control to use to hit the database and populate control; should I make a "Populate this Control" Method on the usercontrol and call it from the Containing page? Or use a Page_Load routine in the user control?