I have 5 dropdown lists and am trying to make it so if I choose a certain value on a certain dropdown list, it won't show that specific item on the following dropdown lists.
I am doing this through a specific SQL query on each dropdown list's data source, the code is in the following pastebin link because the StackOverflow textbox is buggy for me for some reason: http://pastebin.com/gDm8MPrL
I'm not exactly sure why, but it isn't displaying anything from the database. When I test a normal "SELECT *" query it works, so it isn't a connection problem.
Could anyone give me a hand?
Thanks!
PASTED CODE FROM PASTE BIN
<asp:DropDownList ID="ddlHero1" runat="server" DataSourceID="ddlDataSource0" DataTextField="ChampName" DataValueField="ChamadpName" AutoPostBack="True">
</asp:DropDownList>
<asp:SqlDataSource ID="ddlDataSource0" runat="server" ConnectionString="<%$ ConnectionStrings:mobamanagerConnectionString%>" SelectCommand="SELECT [ChampName] FROM [Champions] WHERE Champname NOT IN (
SELECT [ChampName] FROM [Champions] WHERE Champname=@ddlHero2
UNION
SELECT [ChampName] FROM [Champions] WHERE Champname=@ddlHero3
UNION
SELECT [ChampName] FROM [Champions] WHERE Champname=@ddlHero4
UNION
SELECT [ChampName] FROM [Champions] WHERE Champname=@ddlHero5)">
<SelectParameters>
<asp:ControlParameter ControlID="ddlHero2" Name="ddlHero2"
PropertyName="SelectedValue" />
<asp:ControlParameter ControlID="ddlHero3" Name="ddlHero3"
PropertyName="SelectedValue" />
<asp:ControlParameter ControlID="ddlHero4" Name="ddlHero4"
PropertyName="SelectedValue" />
<asp:ControlParameter ControlID="ddlHero5" Name="ddlHero5"
PropertyName="SelectedValue" />
</SelectParameters>
</asp:SqlDataSource>
This process is repeated another 4 times with different queries for each DDL, but the procedure is identical.
EDIT: Thanks for pasting the code in, mod!