Link to home
Start Free TrialLog in
Avatar of amillyard
amillyardFlag for United Kingdom of Great Britain and Northern Ireland

asked on

2 sql database driven drop-down lists to link up

Development plaform: C# ASP.net 2.x, SQL 2005, MS Visual Studio Pro using Web Developer, IIS 6

Hi there,

I am trying to get these 2 sql database driven drop-down lists to link up.

i.e. depending on what the first drop-down list option is select will determine what the second drop-down list will display.  Essentially, fire-up another sql search for related records etc.

Below is the shell of the program -- these 2 sql-based drop-down menus are working fine independately -- just need to get them to link up.

Could someone please add to this scripting the additional coding I need to consider in order to get it working?

<asp:DropDownList ID="DropDownList1" runat="server" DataSourceID="SqlDataSource1"
            DataTextField="LeadSourceProviderName" DataValueField="LeadSourceProvider_ID">
        </asp:DropDownList>
        &nbsp; &nbsp;
        <asp:DropDownList ID="DropDownList2" runat="server" DataSourceID="SqlDataSource2"
            DataTextField="LeadSourceProviderProductName" DataValueField="LeadSourceProviderProducts_ID">
        </asp:DropDownList><br />
        <br />
        <br />
        <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:FORTUNEConnectionString %>"
            SelectCommand="SELECT [LeadSourceProvider_ID], [LeadSourceProviderName] FROM [LeadSourceProviders] ORDER BY [LeadSourceProviderName]">
        </asp:SqlDataSource>
        <br />
        <br />
        <asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:FORTUNEConnectionString %>"
            SelectCommand="SELECT [LeadSourceProviderProducts_ID], [LeadSourceProviderProductName], [LeadSourceProvider_ID] FROM [LeadSourceProviderProducts] ORDER BY [LeadSourceProviderProductName]">
        </asp:SqlDataSource>


Thank you in advance for your time and efforts with this enquiry.
Avatar of Sammy
Sammy
Flag of Canada image

AutoPostaback should be set to true in the first Dropdownlist
Avatar of amillyard

ASKER

ok, done that -- but this is not making the 2nd dro-down box react any differently, only that the screen page refreshes.
ASKER CERTIFIED SOLUTION
Avatar of Sammy
Sammy
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
100 % spot on -- apprieate your time and efforts with enquiry.

thank you.
You welcome :-)