Since the data is now dependent on the selection of the
DropDownList, I will configure the SqlDataSource control to reflect the
changes.
Listing 5 – Configuring Data Source for
DropDownList
<asp:SqlDataSource ID="SqlDataSource1"
runat="server" ConnectionString="<%$
ConnectionStrings:TaskDatabaseConnectionString %>"
SelectCommand="SELECT [Name], [Address] FROM
[Contacts] WHERE ([City] = @City)">
<SelectParameters>
<asp:ControlParameter
ControlID="ddlCity" Name="City"
PropertyName="SelectedValue"
Type="String" />
</SelectParameters>
</asp:SqlDataSource>