RadProgressManager + RadProgressArea Dilemma

Thread is closed for posting
9 posts, 0 answers
  1. DoomerDGR8
    DoomerDGR8 avatar
    133 posts
    Member since:
    Aug 2010

    Posted 15 Dec 2010 Link to this post

    Hello again!

    I'm trying to visualize a very intensive double for-loop piece of code. The story is that there are a number of job I need to process. Say 200 jobs. For each job, i need to go through a list of workers I have, say 500. There are criteria (address, max distance from job, job type) that shortlist the workers to some extent before the inner for-each worker loop starts.

    So I have a total progress (Total number of jobs) and a secondary progress for each primary unit. I need to get the RadProgressManager + RadProgressArea working here. I used a tutorail and some forum help to get the basics up but the behaviour is not what I accepted. The only thing that is visualizing is the time elapsed thing and the rest of the control just remains still. no progress bar movement at all.

    Currently, the function is taking around 7 minutes to solve 250 jobs. The function has room for improvement, no doubt, but for now, I just need my user(s) to know something is happening and how far along is it.

    Thanks.

    Code:
    protected void Page_Load(object sender, EventArgs e) {
      if (Page.IsPostBack == false) {
     
        if (HasJobsToBook()) {
          FinalSolution.Rows.Clear();
          RetrieveJobsToBookBatchIDs();
          long iCount = RetrieveActualJobsAgainstBatchIDs();
          PreSortTheJobs(iCount);
     
          LabelError.Visible = true;
          LabelError.Text = String.Format("I have {0} job(s) to process!", iCount);
     
          RadProgressAreaGenie.ProgressIndicators &= ~ProgressIndicators.SelectedFilesCount;
        }
     
      }
     
      RadProgressAreaGenie.Localization.Uploaded = "Total Progress";
      RadProgressAreaGenie.Localization.UploadedFiles = "Progress";
      RadProgressAreaGenie.Localization.CurrentFileName = "Job Genie in action!";
    }
     
    private void MatchALocum() {
      LabelError.Visible = false;
      LabelError.Text = string.Empty;
     
      if (CountOfJobsToBook() < 1) {
        LabelError.Visible = true;
        LabelError.Text = "No job(s) to process.";
        Trace.Warn("Job Genie", "No job(s) to process.");
        return;
      }
     
      RadProgressContext progress = RadProgressContext.Current;
      progress.Speed = "N/A";
     
      try {
     
        #region Declerations
     
        int iCounterControl = 0;
        int iCounterControlInner = 0;
     
        foreach (DataRow Row in TableJobsToBook.Rows) {
          iCounterControl = iCounterControl + 1;
     
          progress.PrimaryTotal = TableJobsToBook.Rows.Count;
          progress.PrimaryValue = iCounterControl;
          progress.PrimaryPercent = (iCounterControl / TableJobsToBook.Rows.Count) * 100;
     
          if (!Response.IsClientConnected) {
            //Cancel button was clicked or the browser was closed, so stop processing
            break;
          }
     
          #region Key Extracted Job Properties
     
          #region Availability
     
          #region Distance Preperation
     
          iCounterControlInner = 0;
     
          foreach (long ListOfCandidateLocumID in ListOfCandidateLocumIDs) {
            iCounterControlInner = iCounterControlInner + 1;
     
            progress.SecondaryTotal = ListOfCandidateLocumIDs.Count();
            progress.SecondaryValue = iCounterControlInner;
            progress.SecondaryPercent = (iCounterControlInner / ListOfCandidateLocumIDs.Count()) * 100;
     
            progress.CurrentOperationText = "Step " + iCounterControlInner.ToString();
     
            //Massive + Intensive code here...
     
            //Stall the current thread for 0.1 seconds
            System.Threading.Thread.Sleep(100);
             
          }//For Loop Candidates
     
     
          progress.TimeEstimated = (TableJobsToBook.Rows.Count - iCounterControl) * 100;
           
          //Stall the current thread for 0.1 seconds
          System.Threading.Thread.Sleep(100);
     
        }//For Loop Jobs
     
      } catch (Exception ex) {
        Trace.Warn("Job Genie", "Exception:" + ex.Message);
        throw new Exception("Error while running Job Genie.", ex);
      }
    }

    HTML:
    <telerik:RadProgressManager ID="RadProgressManagerGenie" runat="server" Skin="Office2007" />
    <telerik:RadProgressArea ID="RadProgressAreaGenie" runat="server" Skin="Office2007" Culture="(Default)"
      ProgressIndicators="TotalProgressBar, TotalProgress, TotalProgressPercent, FilesCountBar, FilesCount, FilesCountPercent, SelectedFilesCount, CurrentFileName, TimeElapsed, TimeEstimated"
      Width="100%">
      <Localization Uploaded="Uploaded" />
    </telerik:RadProgressArea>

    Thanks.
  2. DoomerDGR8
    DoomerDGR8 avatar
    133 posts
    Member since:
    Aug 2010

    Posted 19 Dec 2010 Link to this post

    Any pointers please...
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Genady Sergeev
    Admin
    Genady Sergeev avatar
    1596 posts

    Posted 20 Dec 2010 Link to this post

    Hi Hassan,

    Your code looks fine, however, I cannot see where do you call the MatchALocum method. It should be called in the click handler of the button that should trigger the custom progress. Do you do that?

    Greetings,
    Genady Sergeev
    the Telerik team
    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
  5. DoomerDGR8
    DoomerDGR8 avatar
    133 posts
    Member since:
    Aug 2010

    Posted 20 Dec 2010 Link to this post

    Yes. The method is called and executes. But the progress bars don't reflect properly. They are both stuck at zero and only elpased time is ticking...
  6. Genady Sergeev
    Admin
    Genady Sergeev avatar
    1596 posts

    Posted 23 Dec 2010 Link to this post

    Hello Hassan,

    This is strange, since this code works on my machine. Please, open a support ticket and attach there a sample project that reproduces the problem. This will allow to test the issue in our local environment and provide you with a solution quickly.

    All the best,
    Genady Sergeev
    the Telerik team
    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
  7. DoomerDGR8
    DoomerDGR8 avatar
    133 posts
    Member since:
    Aug 2010

    Posted 23 Dec 2010 Link to this post

    So, you believe that I have successfully implemented in the right way and the expected behavior should be that the primary progress bar should step and for every step, the secondary progress bar should go from 0% to 100%? My concern is that maybe I'm not giving it enough time to reflect the animation. Should I increase the delay? Also, while all this is happening, how can i disable the whole page so that the user cannot click any where else?
  8. Genady Sergeev
    Admin
    Genady Sergeev avatar
    1596 posts

    Posted 24 Dec 2010 Link to this post

    Hi Hassan,

    Yes, the code that you have should be working fine. I've tried on a sample project as well and it is correctly updating the area. I don't believe that an animation issue is the problem. I am attaching sample project that shows the area inside a modal pop up, so that the user cannot interact with the rest of the page while a file is being uploaded. Please, host the project on the same server that you have used for testing your project and select a file larger than 40-50mb and press upload. Does the area appear?

    Kind regards,
    Genady Sergeev
    the Telerik team
    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
  9. Juan Carlos
    Juan Carlos avatar
    2 posts
    Member since:
    Dec 2010

    Posted 23 Jan 2011 Link to this post

    I'm having a similar problem. It works fine on a .Net ASP application, however, when I try to do it on a Sharepoint 2010 Application Page the upload page doesn't show any progres... any thoughts? Thanks!
  10. Genady Sergeev
    Admin
    Genady Sergeev avatar
    1596 posts

    Posted 27 Jan 2011 Link to this post

    Hi Juan Carlos,

    Could you please open a support ticket providing details regarding your scenario, do you have the needed handler & module registered in the web.config? Have you tried uploading large files?

    Regards,
    Genady Sergeev
    the Telerik team
    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017