是否可以放弃/中止在发出新请求时仍在处理的 RadAjax请求

本文关键字:请求 RadAjax 处理 放弃 是否 新请求 | 更新日期: 2023-09-27 18:32:53

我有一个 C# Web 应用程序,它向用户提供报告,有时生成报告需要几分钟(而不是几秒钟)。

我有RadTreeView"ReportType"链接,单击时会使用客户端的RadAjaxManager执行RadAjaxRequest

function RadTreeviewNodeClicked(sender, eventArgs) {
            try {
                console.log("fired again: " + eventArgs.get_node().get_text());
                var radAjaxManager = $find("<%= RadAjaxManager.GetCurrent(Page).ClientID %>");
                radAjaxManager.ajaxRequest("NodeClicked");
            } catch (error) {
                console.log("error on nodeclicked");
            }
        }
 //from my pageload
 radAjaxManager1 = RadAjaxManager.GetCurrent(Page);
 radAjaxManager1.AjaxRequest += RadAjaxManager1_AjaxRequest;
 radAjaxManager1.ResponseScripts.Add("AttachJQueryUIDateTimePickers();");
 radAjaxManager1.AjaxSettings.AddAjaxSetting(radAjaxManager1,pnlRightContent,RadAjaxLoadingPanel1);
 radAjaxManager1.ClientEvents.OnResponseEnd = "ResponseEnd";

服务器上的ajaxRequest处理程序为单击的链接加载相应的报告,并将其显示在右侧的 asp:panel 中。 菜单和面板都包裹在RadAjaxPanel中。

如果报表数据仍在加载(存储过程正在执行),并且用户单击了另一个链接:

  • 客户端事件被触发
  • 服务器完成第一个事件
  • 触发响应结束事件
  • 服务器开始处理第二个事件

我想在单击后续事件时放弃/中止第一个事件。 这可能吗?

是否可以放弃/中止在发出新请求时仍在处理的 RadAjax请求

我认为使用

Telerik 可以通过将 rad Ajax Manager 的队列大小设置为 0:

        radAjaxManager1.RequestQueueSize = 0;