How to avoid page refresh after selectedindexchanged of dropdown list?

Aqeel picture Aqeel · Jul 3, 2012 · Viewed 42.4k times · Source

I am using update panel and ASP drop down. When I select any value from a drop down list I load some data from a database that depends on this selected value. However, whenever this selection changes the page will be refreshed. How can I avoid this page refresh? I have also tried AsyncPostBackTrigger but still this problem occurs.

<asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server" EnablePartialRendering="false">
   </asp:ToolkitScriptManager>
        <asp:UpdatePanel ID="OuterUpdatePanel" runat="server">
            <ContentTemplate>
                <asp:DropDownList ID="ddList" CssClass="dropdown" Style="width: 200px !important;"
                 runat="server" AutoPostBack="true" OnSelectedIndexChanged="ddList_SelectedIndexChanged">
                </asp:DropDownList>
            </ContentTemplate>
        </asp:UpdatePanel>

Answer

Ashwin Singh picture Ashwin Singh · Jul 3, 2012

Add this, if you want the dropdownlist to trigger Ajax call without refreshing the page and do not remove AutoPostBack="true"

<Triggers> 
<asp:AsyncPostBackTrigger ControlID="ddList" EventName="SelectedIndexChanged" /> 
</Triggers>