私のデータベースには次のものがあります -
breedId Species Breed
0 dog Alsatian
1 dog pitbull
2 dog Shetland sheepdog
3 dog Boxer
4 cat Dragon Li
5 cat Australian Mist
6 cat Korat
C# デザイナー ビューには、2 つのドロップダウン リストがあり、1 つは種、もう 1 つは品種です。
私が欲しいのは、ユーザーが種のリストで「犬」を選択したときに、品種のリストに次のものが含まれている必要があることですAlsatian, pitbull, Shetland sheepdog,Boxer
「犬」を選択した時点で、データベースのすべての品種が表示されます。
<asp:DropDownList ID="DropDownListSpecies" runat="server"
Height="27px" Width="107px" DataSourceID="hs330"
DataTextField="Species" DataValueField="Species">
</asp:DropDownList>
<asp:SqlDataSource ID="Species" runat="server"
ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
SelectCommand="SELECT DISTINCT [Species] FROM [Breed]">
</asp:SqlDataSource>
<asp:DropDownList ID="DropDownListBreed" runat="server" Height="20px"
Width="110px" DataSourceID="breed" DataTextField="Breed"
DataValueField="Breed">
</asp:DropDownList>
<asp:SqlDataSource ID="breed" runat="server"
ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
SelectCommand="SELECT DISTINCT [Breed] FROM [Breed]">
</asp:SqlDataSource>