0

我在更新面板中有几个按钮。我现在被要求用下拉列表替换按钮。我看到下拉列表上的 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>
4

2 回答 2

0

我遇到了同样的问题,我发现问题出在 _destroyTree 上。在此处检查 ( https://siderite.dev/blog/very-slow-updatepanel-refresh-when.html )。

于 2013-06-04T14:58:39.703 回答
0

好吧,现在似乎对我有用的是为 dropdownlist 设置 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>
于 2013-06-04T15:36:50.567 回答