Long-term ASP.NET Ajax request. Page Responsiveness

When my page loads, I need to immediately initiate a data tuck in one of the page page controls so that it fills in some of the search results that appear in the grid in this user control. A request to search for search results can take quite a while (8-10 seconds).

My goal is to make an Ajax request only to refresh the part of the page containing the user control so that the user can freely interact with other elements on the page, while the expensive user control itself loads its own data.

In my current approach, the user cannot interact with any elements on the page while this control is loading. When they click on the button, for example, in another place on the page, the page_Load () for the button redirection is not achieved until the long ajax request is completed. It seems that other Ajax requests are waiting in line for a long one.

Here is my approach (Telerik Controls used for Ajax):

I have a RadAjaxPanel that has a hidden button that will trigger an Ajax postback. This button is clicked through Javascript when the page loads. In the click handler for the button, there is code to load the user control into the ContentPlaceHolderControl and load the control data.

<telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server" LoadingPanelID="LoadingPanel1">
                <asp:PlaceHolder runat="server" ID="PlaceHolderControl">

                      <!-- user control loaded here -->

                    <telerik:RadButton ID="btnRADAjax" runat="server" Style="visibility: hidden;"></telerik:RadButton>

                </asp:PlaceHolder>

Javascript that calls the button to create the Ajax PostBack:

  function DoAjaxPostBack() {


            var interval = setInterval(function() 
                {
                    if(document.readyState === 'complete') 
                    {
                        var argmnt='';
                         var ajaxManager =  $find("<%=RadAjaxManager.GetCurrent(Page).ClientID %>");
                        ajaxManager.ajaxRequestWithTarget('<%= btnRADAjax.UniqueID %>', argmnt);

                        clearInterval(interval);
                    }
                 },100)
       }

On the Load page:

 If Not IsPostBack Then
            RadScriptManager.RegisterStartupScript(Page, Page.GetType(), "1", "DoAjaxPostBack('');", True)
 End If

, Ajax- ? , , , ? IFrame.

!

+4
2

, RadAjaxPanel, , ASP.NET.

ASP.NET. , , 8-10 , . Page_Load() .

EnableSessionState , .

. :

, ASP.Net , ,

+2

Dev Tools → "" ( F12) "" ( - ). - ( ) , , , . , ASP.NET:

ASP.NET?

ASP.NET -

, ASP.Net , ,

, :

<%@ Page ... EnableSessionState="False" %>

:

<system.web>
    <sessionState mode="Off"></sessionState>
</system.web>

( - ) .

+1

Source: https://habr.com/ru/post/1657633/


All Articles