re-binding dropdownlist

I'm constructing a little page that allows a teacher to assign a student in a class to a group. To select the student I use 2 dropdownlists. The first one is for the last name. The second one is for the first name. This way if there are 2 students with the same last name I can choose which one I want. To test this out I have two students in the database, BooBoo Bear and Bam Bam Rubble.

This is what happens. If I choose "Bear" for the last name after the page loads Boo Boo is the only choice for first name. This is what I expected. If I change my mind and select "Rubble" for the last name then both Boo Boo and Bam Bam are displayed. If I change my mind again and select "Bear" again the First Name dropdownlist then shows Boo Boo, Bam Bam, and then Boo Boo again. Auto Postback is set to true. Below is the applicable code. I did try to re-bind the FirstName dropdownlist but that didn't work.

    <div id="divLastName" style="position:absolute; top:120px; left:25px; width:150px; text-align: left;">
        <asp:Label ID="lblLastName" runat="server" Text="Last Name"></asp:Label>
        <asp:DropDownList ID="ddlLastName" runat="server" DataSourceID="sdsLastName" AutoPostBack="True" DataTextField="LastName" DataValueField="LastName" AppendDataBoundItems="true" OnSelectedIndexChanged="ddlLastName_SelectedIndexChanged">
            <asp:ListItem Value="0">&lt;--Select Name--&gt;</asp:ListItem></asp:DropDownList>
    <div id="divFirstName" style="position:absolute; top:120px; left:185px; width:150px; text-align: left;">
        <asp:Label ID="lblFirstName" runat="server" Text="First Name"></asp:Label>
        <asp:DropDownList ID="ddlFirstName" runat="server" DataSourceID="sdsFirstName" DataTextField="FirstName" DataValueField="FirstName" AutoPostBack="True" AppendDataBoundItems="true">
            <asp:ListItem Value="0">&lt;--Select Name--&gt;</asp:ListItem></asp:DropDownList>

    <asp:SqlDataSource ID="sdsLastName" runat="server" ConnectionString="<%$ ConnectionStrings:SchoolDirectory %>" ProviderName="<%$ ConnectionStrings:SchoolDirectory.ProviderName %>" SelectCommand="usp_GetLastNameByClassID_byRB" SelectCommandType="StoredProcedure">
            <asp:ControlParameter ControlID="ddlClassList" Name="p_ClassID" PropertyName="SelectedValue" Type="Int32" />
    <asp:SqlDataSource ID="sdsFirstName" runat="server" ConnectionString="<%$ ConnectionStrings:SchoolDirectory %>" ProviderName="<%$ ConnectionStrings:SchoolDirectory.ProviderName %>" SelectCommand="usp_GetFirstNameByLastName_byRB" SelectCommandType="StoredProcedure">
            <asp:ControlParameter ControlID="ddlClassList" Name="p_ClassID" PropertyName="SelectedValue" Type="String" />
            <asp:ControlParameter ControlID="ddlLastName" Name="p_LastName" PropertyName="SelectedValue" Type="String" />
    </asp:SqlDataSource> C#
    protected void ddlLastName_SelectedIndexChanged(object sender, EventArgs e)
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

AndyAinscowFreelance programmer / ConsultantCommented:
What happens if you change that setting to false ?

ps.  This sounds over complex having two separate control list for first and last names rather than just one for the complete name (and the user can still select the wrong one, so IMHO it won't reduce the chance of incorrect entry)

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
bobbellowsAuthor Commented:
I see what you're saying. In fact it might even increase the chance of a mistake. The names are only stored as FirstName and LastName. I'm somewhat new to c# programming and only a little more experienced with I'm not sure how to build a dataset of FirstName+LastName. BTW the append = False worked. Thanks. Sorry for the delay. My day job kept me from getting back to this till now.

If you can point me in a direction for the other dataset, I'll start working on that. Again. Thanks.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.