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

kapiljoshiAsked:
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.

pschramaCommented:
I tried it out and it works just fine for me. Not sure why it doesn't work for you.

There's no need to define the trigger though if you don't set ChildrenAsTriggers to false, you could try this instead:


<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
    <asp:UpdatePanel Visible="true" runat="server" UpdateMode="Conditional">
        <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>

Open in new window

0

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
kapiljoshiAuthor Commented:
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.
0
pschramaCommented:
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.
0
kapiljoshiAuthor Commented:
ok. wait i'll check out if i can make out a marked difference using the AJAX control & without one.
0
kapiljoshiAuthor Commented:
ok i got it now, i tested it with a Button control .

Thanx.
0
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
ASP.NET

From novice to tech pro — start learning today.