ASP.Net代码后面等一个ADO.对数据库返回的Net查询进行重定向

本文关键字:Net 返回 数据库 重定向 ADO 查询 代码 ASP 一个 | 更新日期: 2023-09-27 18:18:13

I have a asp.net webform page who uses 2 google charts, I'm using Jquery Ajax to retrieve information from database to populate the charts, the query to retrieve the chart data takes a long time, in this time user can make a click in a link to redirect to another page, the redirect is very slow because wait querys return from database to do the redirect, how can I avoid this behavior?
I'm using Jquery Datatable plugin, when user click one row an javascript event is called

function redirectToCampaignCreator(campaignID) {尝试{美元.xhrPool.abortAll ();重定向= true;$ (' # multiCampID ') .val (campaignID);//window.location。href =" campaigncreator.aspx?Edit=True&DoPartialPostBack("& lt; % = btnCampaignEdit.UniqueID %> ");} catch (e) {}}

In this function I cancel the Ajax calls and do a __doPostBack(control, ""); to ejecute some code to save session values and then redirect 
protected void Page_PreInit(object sender, Even`enter code here`tArgs e)
    {
        if (IsPostBack)
        {
            if (Request.Form["multiCampID"] != null)
            {
                View();
                Context.Response.Redirect("CampaignCreator.aspx?Edit=True", true);
            }
        }
    }
The redirect is slow because it's waiting querys return from DB

ASP.Net代码后面等一个ADO.对数据库返回的Net查询进行重定向

你能让你的链接客户端,而不是通过重定向链接在后面的代码?

链接到其他页面

我不知道你是如何使用代码结构来管理这样的任务,但如果你想要你的响应是免费的,你可以使用异步你的c#函数。

https://msdn.microsoft.com/en-us/library/hh191443.aspx