views:

16

answers:

1

Hey I'm having an issue updating a dropdown box inside of an update panel.

Works perfectly if the page posts back, but I'd prefer seemless loading:

Here my form code:

<asp:ScriptManager ID="ScriptManager1"  EnablePartialRendering="true" runat="server">
</asp:ScriptManager>


            <asp:UpdatePanel ID="ajaxClassifications" UpdateMode="Conditional" runat="server">
            <ContentTemplate>
                <td style="font-size: small; color: #003853; width: 50%;">
                    <asp:DropDownList AutoPostBack="true" ID="ddlClassifications" runat="server" Width="99%"
                     Style="font-size: medium" OnSelectedIndexChanged="ddlClassifications_SelectedIndexChanged">
                    </asp:DropDownList>
                </td>
                <td style="font-size: small; color: #003853; width: 50%;">
                    <asp:DropDownList ID="ddlSubClassifications" runat="server" Width="99%" Style="font-size: medium">
                    </asp:DropDownList>
                </td>
            </ContentTemplate>
            <Triggers>
            <asp:AsyncPostBackTrigger ControlID="ddlClassifications" EventName="SelectedIndexChanged" />
            </Triggers>
        </asp:UpdatePanel>

Heres the code in my code behind:

protected void ddlClassifications_SelectedIndexChanged(object sender, EventArgs e)
{
    ddlSubClassifications.Items.Clear();
    getSubClassifications(int.Parse(ddlClassifications.SelectedValue));
}

Is there something I am missing here?

Thanks in advance!

A: 

You still need the auto-post="true" on the ddlClassifications dropdownlist in order to post back to the server.

RPM1984