0
我有兩個下拉列表,程度和程序分別,我想根據從度下拉列表中選擇的程度生成程序列表值。我怎麼能做到這一點,代碼如下:將參數傳遞給SQLDataSource
<asp:DropDownList ID="Degree_DList" runat="server" DataSourceID="Degrees_DropdownList"
DataTextField="DEGREE_NAME" DataValueField="DEGREE_ID" AppendDataBoundItems="True">
</asp:DropDownList>
<asp:SqlDataSource ID="Degrees_DropdownList" runat="server" ConnectionString="<%$ ConnectionStrings:admConnectionString %>" ProviderName="<%$ ConnectionStrings:admConnectionString.ProviderName %>"
SelectCommand="SELECT DEGREE_ID, DEGREE_NAME FROM DEGREE"> </asp:SqlDataSource>
<asp:DropDownList ID="Program_Dlist" runat="server" AppendDataBoundItems="True" DataSourceID="Programs_DropdownList" DataTextField="PROGRAM_NAME" DataValueField="PROGRAM_ID"></asp:DropDownList>
<asp:SqlDataSource ID="Programs_DropdownList" runat="server" ConnectionString="<%$ ConnectionStrings:admConnectionString %>" ProviderName="<%$ ConnectionStrings:admConnectionString.ProviderName %>"
SelectCommand="SELECT PROGRAM_ID, PROGRAM_NAME FROM PROGRAMS WHERE DEGREE_ID = @DEGREE_ID"><SelectParameters>
<asp:ControlParameter Name="DEGREE_ID" ControlID="Degree_DList" PropertyName="SelectedValue" />
</SelectParameters>
</asp:SqlDataSource>
現在它在DropDown列表中沒有顯示任何內容 – Umair 2012-03-13 09:58:41
哪一個?用於第一個下拉列表的應該保持不變。對於第二個你應該提供輸入的地方(我想反應selectedindexchanged)。 – 2012-03-13 10:05:33
我想第二個下拉列表完全動態,它會根據第一個下拉列表中的選定項目生成值列表 – Umair 2012-03-13 10:12:52