与更新面板中的按钮单击相比,asp.net下拉列表selectedindexchanged缓慢触发

时间:2013-06-04 14:23:38

标签: c# asp.net visual-studio-2010 updatepanel

我在更新面板中有几个按钮。我现在被要求更换按钮          下拉列表。我看到下拉列表中的selectedindexchanged事件要慢得多          比按钮点击事件。我有下面的代码。任何人都能指出我为什么会这样吗?          或者我可以做些什么来更快地使selectedindexchanged事件响应。

  <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>

2 个答案:

答案 0 :(得分:0)

我遇到了同样的问题,我发现问题出在_destroyTree上。在这里查看(http://siderite.blogspot.com/2008/06/very-slow-updatepanel-refresh-when.html)。

答案 1 :(得分:0)

现在看来对我有用的是为下拉列表设置AutoPostback =“true”。

<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>