Scenario: I am trying to get values from 2 Dropdown selections so that I can display associated data from my database 'HighSchoolFootballTeam. I have gotten the error messages:
'The multi-part identifier "DropDownClass.SelectedValue" could not be bound.'
'The multi-part identifier "DropDownRegion.SelectedValue" could not be bound.'
'Invalid column name 'HighSchoolTeam'.'
Code:
<WizardSteps>
<asp:WizardStep runat="server" >
<asp:DropDownList ID="DropDownSearchBy" runat="server" OnTextChanged="DropDown_TextChanged">
<asp:ListItem>Drop Down for Choices</asp:ListItem>
<asp:ListItem Value="Class">Classification</asp:ListItem>
<asp:ListItem Value="County">County</asp:ListItem>
<asp:ListItem Value="All">High School Team(s)</asp:ListItem>
</asp:DropDownList>
</asp:WizardStep>
<asp:WizardStep runat="server" >
<asp:DropDownList ID="DropDownClass" runat="server" Width="100px" OnTextChanged="DropDown_TextChanged">
<asp:ListItem Value="A">A</asp:ListItem>
<asp:ListItem Value="AA">AA</asp:ListItem>
<asp:ListItem Value="AAA">AAA</asp:ListItem>
<asp:ListItem Value="AAAA">AAAA</asp:ListItem>
<asp:ListItem Value="AAAAA">AAAAA</asp:ListItem>
<asp:ListItem Value="AAAAAA">AAAAAA</asp:ListItem>
</asp:DropDownList>
</asp:WizardStep>
<asp:WizardStep runat="server" >
<asp:DropDownList ID="DropDownRegion" runat="server" Width="100px" OnTextChanged="DropDown_TextChanged">
<asp:ListItem Value="1">1</asp:ListItem>
<asp:ListItem Value="2">2</asp:ListItem>
<asp:ListItem Value="3">3</asp:ListItem>
<asp:ListItem Value="4">4</asp:ListItem>
<asp:ListItem Value="5">5</asp:ListItem>
<asp:ListItem Value="6">6</asp:ListItem>
<asp:ListItem Value="7">7</asp:ListItem>
<asp:ListItem Value="8">8</asp:ListItem>
</asp:DropDownList>
</asp:WizardStep>
<asp:WizardStep runat="server" Title="High School Team by Class & Region">
<asp:DropDownList ID="DropDownClassRegion" runat="server" DataSourceID="SqlDataSource2" DataTextField="HighSchoolName" DataValueField="HighSchoolName" Width="100px">
</asp:DropDownList>
<asp:SqlDataSource ID="SqlDataSource2"
runat="server"
ConnectionString="<%$ ConnectionStrings:FollowingHSFootballConnectionString %>"
SelectCommand="SELECT [HighSchoolTeam] FROM [HighSchoolFootballTeam$] WHERE [Classification] = DropDownClass.SelectedValue and [Region] = DropDownRegion.SelectedValue">
<SelectParameters>
<asp:ControlParameter Name="Class" ControlID="DropDownClass" PropertyName="SelectedValue" />
</SelectParameters>
<SelectParameters>
<asp:ControlParameter Name="Region" ControlID="DropDownRegion" PropertyName="SelectedValue" />
</SelectParameters>
</asp:SqlDataSource>
</asp:WizardStep>
The database table is as follows:
Column Name Data Type Allow nulls
HighSchoolTeamID int Unchecked
Year int Checked
HighSchoolName varchar(50) Checked
Association varchar(50) Checked
Region int Checked
Classification varchar(50) Checked
County varchar(50) Checked
HomeStadiumID int Checked
Wins smallint Checked
Losses smallint Checked
TwitterFeed varchar(50) Checked
NewspaperID int Checked
AudioInternetLink varchar(50) Checked
VideoInternetLink varchar(50) Checked
SecondaryNewspaperID int Checked
What do you recommend for correcting this?
Thank You,
Michael