Search code examples
c#asp.netvisual-studio-2010updatepanel

asp.net drop down list selectedindexchanged firing slowly compared to button click within update panel


I have a few buttons within an update panel. I have now been asked to replace the buttons with a drop down list . I see that the selectedindexchanged event on the drop down list is much slower than the button click event. I have the code below. Can anyone point me as to why it is happenning ? or what I can do to make the selectedindexchanged event response faster .

  <asp:UpdatePanel ID="UpdatePanel" runat="server">
                        <ContentTemplate>
                            <div class="ui-widget-header" style="display: inline;">
                                <asp:Label ID="lblRefresh" runat="server" Text="Refresh Interval:" CssClass="label"
                                    ForeColor="Black"></asp:Label>&nbsp&nbsp&nbsp
                                <asp:LinkButton ID="btnOFF" runat="server" OnClick="btnOFF_Click" Text="Off">
                                </asp:LinkButton>&nbsp
                                <asp:LinkButton ID="btn60SEC" runat="server" OnClick="btn60SEC_Click" Text="1Min">
                                </asp:LinkButton>&nbsp
                                <asp:LinkButton ID="btn5MIN" runat="server" OnClick="btn5MIN_Click" Text="5Min">
                                </asp:LinkButton>&nbsp
                                <asp:LinkButton ID="btn10MIN" runat="server" OnClick="btn10MIN_Click" Text="10Min">
                                </asp:LinkButton>&nbsp
                                <asp:LinkButton ID="btn15MIN" runat="server" OnClick="btn15MIN_Click" Text="15Min">
                                </asp:LinkButton>
                                <asp:DropDownList ID="ddlRefresh" runat="server" onselectedindexchanged="ddlRefresh_SelectedIndexChanged">
                                <asp:ListItem Text="OFF" Value="0"></asp:ListItem>
                                <asp:ListItem Text="5MIN" Value="5"></asp:ListItem>
                                <asp:ListItem Text="10MIN" Value="10"></asp:ListItem>
                                </asp:DropDownList>
                            </div>
                        </ContentTemplate>
                        <Triggers>
            <asp:AsyncPostBackTrigger ControlID="ddlRefresh" EventName="SelectedIndexChanged"/>
                    </Triggers>
                    </asp:UpdatePanel>

Solution

  • Well what seems to work for me right now is to set AutoPostback = "true" for the dropdownlist .

    <asp:DropDownList ID="ddlRefresh" runat="server" onselectedindexchanged="ddlRefresh_SelectedIndexChanged" AutoPostBack="true">
                                        <asp:ListItem Text="OFF" Value="0"></asp:ListItem>
                                        <asp:ListItem Text="5MIN" Value="5"></asp:ListItem>
                                        <asp:ListItem Text="10MIN" Value="10"></asp:ListItem>
                                        </asp:DropDownList>