Hi,
Can you show me how to use RadProgressArea while loading data from a sql server? Here is my scenario:
I have a RadButton. when a user click on this button, I have a function call RetrieveData() and this function will connect to a sql database and query about 100,000 records and performing a lot of data manipulation so it will take awhile to produce desire data.
while processing the data, I would like to display like a progress bar so user can see what's going on and wait. I found the demo here:
http://demos.telerik.com/aspnet-ajax/upload/examples/customprogress/defaultcs.aspx and really like it, but I don't know how to apply it to my scenario. From the example, it sets the total process = 100, but in my case, my query run can take up to 3 minutes. Please provide code as possible. Here is my code behind page:
protected void RetrieveData()
{
//using LINQ to SQL to select data
}
Please help, thanks in advance!
Can you show me how to use RadProgressArea while loading data from a sql server? Here is my scenario:
I have a RadButton. when a user click on this button, I have a function call RetrieveData() and this function will connect to a sql database and query about 100,000 records and performing a lot of data manipulation so it will take awhile to produce desire data.
while processing the data, I would like to display like a progress bar so user can see what's going on and wait. I found the demo here:
http://demos.telerik.com/aspnet-ajax/upload/examples/customprogress/defaultcs.aspx and really like it, but I don't know how to apply it to my scenario. From the example, it sets the total process = 100, but in my case, my query run can take up to 3 minutes. Please provide code as possible. Here is my code behind page:
protected void Page_Load(object sender, 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 = "Please wait while updating database... "; }protected void RetrieveData()
{
//using LINQ to SQL to select data
}
private void UpdateProgressContext() { RadProgressContext progress = RadProgressContext.Current; const int total = 100; 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(50); } }protected void RadButton1_Click(object sender, EventArgs e) { UpdateProgressContext(); //I assume this is how it call RetrieveData(); }