gpt4 book ai didi

c# - 如何禁用 ASP.NET 中某些控件的 UpdateProgress?

转载 作者:行者123 更新时间:2023-11-30 12:57:57 26 4
gpt4 key购买 nike

我有一个使用 ASP.NET 开发的网站。那里发生了很多 ajax 请求。所以我想在发生ajax请求时显示图像并在加载数据后隐藏图像。现在一切正常,

这是我到目前为止所做的

<asp:UpdateProgress ID="UpdateProgress1" runat="server" AssociatedUpdatePanelID="uppnlLocation">
<ProgressTemplate>
<img src="images/loading.gif" />
</ProgressTemplate>
</asp:UpdateProgress>

<asp:UpdatePanel runat="server" UpdateMode="Conditional" ID="uppnlLocation">
<ContentTemplate>
<asp:DropDownList ID="ddContinents" runat="server" CssClass="form-control" OnSelectedIndexChanged="ddContinents_SelectedIndexChanged" AutoPostBack="true"> </asp:DropDownList>

<asp:TreeView runat="server" ID="tvCountries" OnSelectedNodeChanged="tvCountries_SelectedNodeChanged"></asp:TreeView>
</ContentTemplate>
</asp:UpdatePanel>

所以在上面的代码中,当用户从下拉列表中选择一个大陆时,属于该大陆的国家将被加载到下面的 TreeView 中。因此,当用户在加载国家/地区时从下拉列表中选择大陆时,我想显示加载图像。现在这是工作。但问题是当用户在 treeview 中选择一个树节点时它也会显示这个进度控制图像。我不想在那个 Action 上显示那个图像。如何禁用它?

我看到了一篇关于这个的帖子。

Is there a way to disable UpdateProgress for certain async postbacks?

我实现了它。但是下拉菜单不会发生回发。

那么如何实现呢?

非常感谢。

最佳答案

最好只使用 DisplayAfter参数来提高这是出现的延迟,因为我知道这发生得太快了。不要使用复杂的 javascript 解决方案,只需添加 1 或 2 秒的延迟...

<asp:UpdateProgress ID="UpdateProgress1" 
runat="server" AssociatedUpdatePanelID="uppnlLocation" DisplayAfter="2000">
<ProgressTemplate>
<img src="images/loading.gif" />
</ProgressTemplate>
</asp:UpdateProgress>

关于c# - 如何禁用 ASP.NET 中某些控件的 UpdateProgress?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32087879/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com