Hi Rit,
AFAIK, it doesn't really matter. The DataSource controls aren't triggered until they are necessary.
You can very easily see for yourself how this works by creating a sample page:
1. Add a GridView
2. Bind the GridView to a new SqlDataSource and enable Editing on the GridView.
3. Customize one column of the grid (make it an item template)
4. Customize the EditItem template. Remove the text box and add a DropDownList control. Bind it to a new and embedded (inside the ItemTemplate) DataSource control and set its DataBindings.
5. Selected the embedded DataSource control, and hook up a handler for its Selecting event (that fires when it's about to access the database)
6. Repeat this for the "outer" DataSource.
7. Set breakpoints on both handlers in the code behind.
8. Run the page.
You'll see that only the outer Selecting event is triggered. As soon as you click Edit the inner Selecting event is now triggered to get data for the DropDownList.
9. Next, cut the inner DataSource from the template and past it below the outer DataSOurce control. Run the page again.
You'll see the exact same behavior. The "inner" DataSource control doesn't access the data, until it's required by another control.
Maybe there are circumstances where the above isn't true, but this is how I have always seen the DataSource controls operate.
Hope this helps,
Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
Author of
ASP.NET 2.0 Instant Results and
Beginning Dreamweaver MX / MX 2004