asp.net下拉列表回发

asp.net下拉列表回发,asp.net,sql,vb.net,visual-studio-2012,Asp.net,Sql,Vb.net,Visual Studio 2012,我有一个下拉列表,比如a、B、C、D。所有a、B、C都从同一个表中提取数据(表1)。D从另一个表中提取(表2,但在sql查询中也将使用表1)。我想要实现的是,一旦从a中取下一个值,然后自动选择B、C、D中的值。 我当前的asp代码只能使当选择下拉列表a的随机值时,B、C可以自动选择值,而不是D。第二次选择a中的随机值时,所有B、C、D都可以选择值 我的代码如下: A B C D 我想知道如何实现,一旦从a中取下一个值,然后自动选择B、C、D中的值(我猜D没有首先选择的原因是它的

我有一个下拉列表,比如a、B、C、D。所有a、B、C都从同一个表中提取数据(表1)。D从另一个表中提取(表2,但在sql查询中也将使用表1)。我想要实现的是,一旦从a中取下一个值,然后自动选择B、C、D中的值。 我当前的asp代码只能使当选择下拉列表a的随机值时,B、C可以自动选择值,而不是D。第二次选择a中的随机值时,所有B、C、D都可以选择值

我的代码如下: A


B


C


D


我想知道如何实现,一旦从a中取下一个值,然后自动选择B、C、D中的值(我猜D没有首先选择的原因是它的sql查询)。
谢谢你的建议

也许这是有帮助的:我会说使用一个更新面板。并将第一个下拉列表用作触发器。
            <asp:DropDownList ID="DropDownListA" class="ddStyle" runat="server" DataSourceID="SqlDataSource2" DataTextField="country" DataValueField="country" AppendDataBoundItems="true" AutoPostBack="True" EnableViewState="true" ViewStateMode="Enabled">
                       <asp:ListItem Text="--Select One--" Value="" Selected="True" />  </asp:DropDownList>
    <asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>" SelectCommand="select distinct country from table1 order by country"></asp:SqlDataSource>
  <asp:DropDownList ID="DropDownList2" class="ddStyle" runat="server" DataSourceID="SqlDataSource1" DataTextField="GICS" DataValueField="GICS" AutoPostBack="True"></asp:DropDownList>
                        <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>" SelectCommand="select distinct GICS, country from table1 where country=@country">
                            <SelectParameters>
                                <asp:ControlParameter ControlID="DropDownListA" Name="country" PropertyName="SelectedValue" />
                            </SelectParameters>
                        </asp:SqlDataSource>
  <asp:DropDownList ID="DropDownListC" class="ddStyle" runat="server" DataSourceID="SqlDataSource3" DataTextField="company" DataValueField="id" AutoPostBack="True"></asp:DropDownList>
                            <asp:SqlDataSource ID="SqlDataSource3" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>" SelectCommand="select company, GICS, country, id from table1 where gics=@gics and country=@country">
                                <SelectParameters>
                                    <asp:ControlParameter ControlID="DropDownListB" Name="gics" PropertyName="SelectedValue" />
                                     <asp:ControlParameter ControlID="DropDownListA" Name="Country" PropertyName="SelectedValue" />
                                </SelectParameters>
                            </asp:SqlDataSource>
                            <asp:SqlDataSource ID="SqlDataSource5" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>" SelectCommand="select edition, company, id from table2 where table2.company in (select company from table1 where table1.id=@id)">
                                <SelectParameters>
                                    <asp:ControlParameter ControlID="DropDownListC" Name="id" PropertyName="SelectedValue" />
                                </SelectParameters>
                            </asp:SqlDataSource>
                            <asp:SqlDataSource ID="SqlDataSource4" runat="server"></asp:SqlDataSource>