USE A PROGRESS BAR WITH A LONG-TERM PROCESS ON THE SERVER SIDE THAT UPDATES A CONTROL ON THE CLIENT SIDE.

Preamble:
----------
In Asp.net it is required to use a Progress Bar <dx: ASPxProgressBar ID="Form_ProgressBar"> that allows to represent asynchronously the duration of a background process on the Server side executed by the Fcn_AppConexionesSelectedIndexChanged() function and that also updates the <dx: ASPxNavBar ID="Form_NavBar"> control on the Client Side.

On the server side it is required to be able to use a Session variable to Store and Retrieve Information. The web page does more things that requires Session variables.

In the code that serves as an example, we have a control <asp: DropDownList ID="Form_Conexiones" runat="server" AutoPostBack="false" OnChange="javascript: Fcn_ProgressBar_In Start ('ProgressBar_In Start');"/>
with an "OnChange" event that executes a javascript function Fcn_ProgressBar_In Start() that starts the 2 Callback processes:

-Callback 1. Activates a function on the Server Side Fcn_AppConexionesSelectedIndexChanged() that Executes a Long-Term Process and that Updates the information of a <dx: ASPxNavBar ID="Form_NavBar"> control.
-Callback 2. Activates a function on the Server Side Fcn_ProgressBar_Callback_jQuery() that Retrieves the Position in the long-term process and returns to the Client part to activate it in the <dx: ASPxProgressBar ID="Form_ProgressBar"> control.

Code:
Client side.
 ------------
<script language="javascript" type="text/javascript"> 
 // Function that Executes Actions according to the variable "action". 
function Fcn_ProgressBar_Acciones_(accion)
{
      switch (accion)
      {  case 'ProgressBar_Iniciar':
                 Form_ProgressBar_CallbackPanel.PerformCallback();  // Callback of Long Term Process.
                 Fcn_ProgressBar_PerformCallback_jQuery();                // Callback of the Process that Recovers the Position of the Progress Bar in the Long-Term Process .
                 break;
      }
}

 // Function that Recovers the Position of the Progress Bar in the Long Duration Process. Callback to function  Fcn_ProgressBar_Callback_jQuery().
function Fcn_ProgressBar_PerformCallback_jQuery()
{
     $.ajax({
            type: "POST",
            dataType: "json",
            contentType: "application/json; charset=utf-8",
            url: "busqueda.aspx/Fcn_ProgressBar_Callback_jQuery",
            success: function(success)
            {   var Position = success.d;
                Form_ProgressBar.SetPosition(Position);        // ProgressBar. Update Position .
                Fcn_ProgressBar_PerformCallback_jQuery();  // New Callback to the Fcn_ProgressBar_Callback_jQuery() function that Retrieves the Position of the Progress Bar in the Long Duration Process .
            }
}
</script>

 // ProgressBar.
<dx:ASPxProgressBar ID="Form_ProgressBar" runat="server"/>

// Long-Term Process Updating Control  <dx:ASPxNavBar ID="Form_NavBar">.  Callback Panel.
<dx:ASPxCallbackPanel ID="Form_ProgressBar_CallbackPanel" runat="server" OnCallback="Fcn_AppConexionesSelectedIndexChanged">
            <asp:updatepanel ID="Form_UpdatePanel1" runat="server">
                 <ContentTemplate>
                         // Control that Activates Callback of the Long Duration Process through the event "OnChange".
                       <asp:DropDownList ID="Form_Conexiones" runat="server" AutoPostBack="false" OnChange="javascript:Fcn_ProgressBar_Iniciar('ProgressBar_Iniciar');"/>
                        // Control that will be updated with New Information in the Long-Term Process.
                         <dx:ASPxNavBar ID="Form_NavBar" runat="server"/>
                     </ContentTemplate> 
                </asp:updatepanel>
           </dx:ASPxCallbackPanel>

// CodeBehind. Function that Returns the Position of the Progress Bar in the Long Term Process. Ej.:0-100.
public static Position;
public static string Fcn_ProgressBar_Callback_jQuery()
{  return Position; }

// CodeBehind. Function that Performs the Long-Term Process and Updates the Control <dx:ASPxNavBar ID="Form_NavBar">
protected void Fcn_AppConexionesSelectedIndexChanged(object sender, DevExpress.Web.CallbackEventArgsBase e)
{   // ProgressBar. Position.
    for (Position = 1; Position <= 100; Position++)
    { ... // Update control information <dx:ASPxNavBar ID="Form_NavBar">.
    } 
 }
Trouble:
---------
-It is necessary that the two Callbacks run simultaneously. At this time, while the Long Duration Process Callback is executing,
the Callback that Retrieves the Position in the long-term process and that returns to the Client part to activate it in the <dx: ASPxProgressBar ID="Form_ProgressBar"> control remains waiting the first callback ends.
-If I use a thread in the Fcn_AppConexionesSelectedIndexChanged () function of the long-term process, it ends immediately and the second Callback begins, but then the <dx: ASPxNavBar ID = "Form_NavBar"> control It does not actualize.

Links
------
https://docs.devexpress.com/AspNet/4...epts/callbacks
https://supportcenter.devexpress.com...ack-processing

Excerpt retrieved following the second Link:
Simultaneous session state and callbacks.
---------------------------------------------
-Concurrent callbacks don't work if you use session state. Blocks parallel execution and forces parallel requests to run one after another because access to state of the ASP.NET session is unique per session. For this reason, the above example (How to display progress information about server-side callback processing) does not work if you use session state. To work around this problem, turn off session state at the page or project level. Ex: <% @ Page Language = "C #" CodeFile = "Default.aspx.cs" Inherits = "_ Default" EnableSessionState = "False"%>
When session state is disabled, it is no longer possible to use session variables.

You can use the following alternatives:
-Application state, The application state stores variables that can be accessed by all users of an ASP.NET application.
-Profile properties, Profile properties preserve user values ​​in a data store without expiring.
-ASP.NET caching, ASP.NET caching stores values ​​in memory that is available to all ASP.NET applications.
-Cookies
-Query string and fields, The query string and fields in an HTML form that are available from an HTTP request.

CURRENT SITUATION: At this point I have been stopped waiting to find a viable solution.

=========================================
When a ProgressBar is used, it is to represent a long process in CodeBehind and that process usually has a final result that will be displayed on the screen.

As the Callbacks go one after the other, we are talking about using a thread in the first Callback so that it ends and the second Callback can be activated, which is the one that retrieves values ​​from the first process in the ThRead.

But then, it is necessary that before ending the process in the ThRead, the updateprogress where the navbar control is found is forced to render. Can be done?

Another possible option is in the capture of asynchronous transfers. See bb398976(v=vs.100)

Code:
Example:
var PageRequestManager_ = Sys.WebForms.PageRequestManager.getInstance ();
PageRequestManager_.add_initializeRequest (Fcn_UpdateProgress_InitializeRequest);
PageRequestManager_.add_endRequest (Fcn_UpdateProgress_EndRequest);
PageRequestManager executes from the server side various events on the client side in which it returns information. Can you create a custom event that runs every x time on the server side and returns information to the client side? Why haven't they thought of that?