How to open Telerik Rad Pop Up window Asynchronously?

I am opening a Telerik RadWindowManager Pop up. There is a long Database operation to be performed. During loading i.e. approximately for 35-40 seconds, for the moment, I keep on waiting until the process will come to an end.

Is there any way to load the design first and show a Loader / progress bar to inform the user to wait...Actually the problem gets worse when the Internet speed is slow...

Any suggestion....

0

3 Answers

Here I have a good example. See here for demo.

aspx file:

<telerik:RadScriptManager runat="server" /> <telerik:RadAjaxManager runat="server" OnAjaxRequest="RadAjaxManager1_AjaxRequest"/> <p> Press the submit button in order to start monitoring custom progress </p> <asp:button runat="server" Text="Submit" OnClick="buttonSubmit_Click" CssClass="RadUploadButton" /> <telerik:RadProgressManager runat="server" /> <telerik:RadProgressArea runat="server" />

aspx.cs file:

 protected void Page_Load(object sender, System.EventArgs e) { if (!IsPostBack) { //Do not display SelectedFilesCount progress indicator. RadProgressArea1.ProgressIndicators &= ~ProgressIndicators.SelectedFilesCount; } RadProgressArea1.Localization.Uploaded = "Total Progress"; RadProgressArea1.Localization.UploadedFiles = "Progress"; RadProgressArea1.Localization.CurrentFileName = "Custom progress in action: "; } protected void buttonSubmit_Click(object sender, System.EventArgs e) { UpdateProgressContext(); } private void UpdateProgressContext() { const int total = 100; RadProgressContext progress = RadProgressContext.Current; progress.Speed = "N/A"; for (int i = 0; i < total; i++) { progress.PrimaryTotal = 1; progress.PrimaryValue = 1; progress.PrimaryPercent = 100; progress.SecondaryTotal = total; progress.SecondaryValue = i; progress.SecondaryPercent = i; progress.CurrentOperationText = "Step " + i.ToString(); if (!Response.IsClientConnected) { //Cancel button was clicked or the browser was closed, so stop processing break; } progress.TimeEstimated = (total - i) * 100; //Stall the current thread for 0.1 seconds System.Threading.Thread.Sleep(100); } } 

Now it should be easier to integrate your code.

EDIT: To trigger your Database operation after setting up your RadProgressArea in the PageLoad, you'll need some ajax call to be made after first page load (So I just added the RadAjaxManager to the ascx file upper). Use this code to trigger your DataBase call:

javascript:

 function pageLoad(sender, eventArgs) { if (!eventArgs.get_isPartialLoad()) { $find("<%= RadAjaxManager1.ClientID %>").ajaxRequest("StartDBOperation"); } } 

ascx.cs file:

 protected void RadAjaxManager1_AjaxRequest(object sender, Telerik.Web.UI.AjaxRequestEventArgs e) { if (e.Argument == "StartDBOperation") { // Start DB operation here.. } }
6

Still an Alternative below... But not a solution

I can show a loading panel as follows while the content loads

Mark Up

<div> loading...
</div>
<asp:Button runat="server" Text="RadButton1" OnClientClick="openRadWnd(); return false;" />
<telerik:RadWindowManager runat="server"> <Windows> <telerik:RadWindow runat="server" NavigateUrl="url" ShowContentDuringLoad="false" OnClientShow="OnClientShow" OnClientPageLoad="OnClientPageLoad"> </telerik:RadWindow> </Windows>
</telerik:RadWindowManager>

JavaScript

<script type="text/javascript"> var loadingSign = null; var contentCell = null; function openRadWnd() { $find("<%=RadWindow1.ClientID %>").show(); } function OnClientShow(sender, args) { loadingSign = $get("loading"); contentCell = sender._contentCell; if (contentCell && loadingSign) { contentCell.appendChild(loadingSign); contentCell.style.verticalAlign = "middle"; loadingSign.style.display = ""; } } function OnClientPageLoad(sender, args) { if (contentCell && loadingSign) { contentCell.removeChild(loadingSign); contentCell.style.verticalAlign = ""; loadingSign.style.display = "none"; } }
</script>

Open the RadWindow with JavaScript on the client, set the desired URL through JavaScript. Performa partial postbacks that do not dispose the RadWindow. If you obtain the URL on the server only - use the same logic, but show the loading sign initially, when the response is done call a script to change the URL of the RadWIndow again.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

You Might Also Like