Question Accessing SQLDatasource within User Control from Parent page.


Jul 15, 2011
Programming Experience
Okay so I have been sitting on this problem for some time now.

One needs a search control that can be used on a number of different pages of once website. So one builds a User Control.

User Control setup. (Child)
It has a couple of listboxes, textboxes, a button and SQLDatasource.
The user selects or enters a value/s in the respected field/s and click the button, the button Click event fires and gets the data from the DB and stores it into the SQLDatasource. This works all fine and dandy.

The parent page setup.
This contains a Gridview that has to display the data contained within the SQLDatasource that is contained in the Child.

The problem.
I have no idea how to access the SQLDatasource to be assigned to the Gridview.


  1. How can one access the SQLDatasource ?
  2. Will the Gridview be able to page ?
  3. If 2 is “NO” what is the alternative option to make it page ?
  4. What will be the best event to assign the SQLDatasource to the Gridview ?
Top Bottom