This is a migrated thread and some comments may be shown as answers.

Custom Progress Area - percentage not getting shown.Shows 0 always

1 Answer 38 Views
AsyncUpload
This is a migrated thread and some comments may be shown as answers.
Vijay
Top achievements
Rank 1
Vijay asked on 21 Dec 2011, 08:00 PM
Hi,

Im trying to use the progress area as per the example on the website.

Following is the piece of code:
private void UpdateProgressContext()
        {
            const int total = 1200;
 
            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;
                int per = (i/total)*100;
                progress.SecondaryPercent = per;
 
                progress.CurrentOperationText = "Step " + i.ToString() + " Per = " + per.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);
            }
        }

In the above piece of code, i have only changed total = 1200 from 100 in the example and tryingt o show the percentage.
It always shows 0.

1 Answer, 1 is accepted

Sort by
0
Vijay
Top achievements
Rank 1
answered on 21 Dec 2011, 08:38 PM
My bad, i had missed out converting to double :)
It works fine.
Tags
AsyncUpload
Asked by
Vijay
Top achievements
Rank 1
Answers by
Vijay
Top achievements
Rank 1
Share this question
or