我有一个使用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>
因此,在上面的代码中,当用户从下拉列表中选择一个大陆时,属于该大陆的国家将被加载到下面的树视图中.因此,当用户在加载国家/地区时从下拉列表中选择一个大陆时,我想显示加载图像.现在这个工作了.但问题是当用户在树视图中选择树节点时它也会显示此进度控制图像.我不想在该动作上显示该图像.如何禁用它?
我看到有关此事的帖子.
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>
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。