Link to home
Start Free TrialLog in
Avatar of kapiljoshi
kapiljoshi

asked on

AJAX Update Panel control with dropdownlist not doing partial postback

I'm using an AJAX Extension Update panel control. I'm using 2 dropdown list controls.

here, once i select an item from the first drpdown the second dropdown should get populated with the related entries. both the dropdowns are in the update panel control. Please refer to the markup code for the same :

In the event handler for cmd_SelectedIndexChanged I have the following in code behind (refer below) :

But everytime i select an item from the cmd dropdown it does a post back refreshing the whole page. please let me know what am i doing wrong to avoid a post back & just do a partial update.

Thanks,
Kapil.
<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
    <asp:UpdatePanel Visible="true" runat="server" ChildrenAsTriggers="false" UpdateMode="Conditional">
        <Triggers>
            <asp:AsyncPostBackTrigger ControlID="cmd" EventName="SelectedIndexChanged"/>
        </Triggers>
        <ContentTemplate>
            <asp:DropDownList ID="cmd" runat="server" AutoPostBack="true"
                onselectedindexchanged="cmd_SelectedIndexChanged">
            </asp:DropDownList>
            <asp:DropDownList ID="cmdOrders" runat="server">
            </asp:DropDownList>
        </ContentTemplate>
    </asp:UpdatePanel>

protected void cmd_SelectedIndexChanged(object sender, EventArgs e)
        {
            populateOrders(cmd.SelectedValue);
        }

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of pschrama
pschrama

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of kapiljoshi
kapiljoshi

ASKER

why i'm saying it doesn't work out for me is that in debug mode when i select the first combo (i.e. the one on whose change index the other combo should get populated) it executes the page_load event. It shouldn't do that , should it ? is it doing the same in your case ?

Or how do i know that its not doing a postback.

thanks for trying it out.
That's normal behaviour, actually. The entire page is loaded again on the server but only the part required by the updatepanel is updated on the client side.
ok. wait i'll check out if i can make out a marked difference using the AJAX control & without one.
ok i got it now, i tested it with a Button control .

Thanx.