Remains constantly at 100%

3 posts, 0 answers
  1. Jordi
    Jordi avatar
    2 posts
    Member since:
    Jun 2012

    Posted 28 Jul 2014 Link to this post

    Good evening.

    I've noticed that the progress bar does not work well when you step with decimal values ​​in Primary or Secondary Percent attribute.

    The bar remains constantly at 100%

    progress.SecondaryPercent = Math.Round (myPercent, 2);

    progress.SecondaryPercent = Math.Round (myPercent, 0);

    I think it's something that has to do with the locale. If working with the decimal encoding Spain (The decimal point is a comma) works bad, if I work with the american encoding works well.

    Sorry for my poor English

    Jordi
  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 29 Jul 2014 in reply to Jordi Link to this post

    Hi Jordi,

    Please have a look into the sample code snippet which works fine at my end.

    ASPX:
    <asp:Button ID="btnUpload" runat="server" Text="Upload" OnClick="btnUpload_Click" />
    <telerik:RadProgressManager ID="Radprogressmanager1" runat="server" />
    <telerik:RadProgressArea ID="RadProgressArea1" runat="server" />

    C#:
    protected void btnUpload_Click(object sender, System.EventArgs e)
    {
        int total = numbers.Count;
        decimal mypercent;
        RadProgressContext progress = RadProgressContext.Current;
        progress.Speed = "N/A";
        for (int i = 0; i < total; i++)
        {
            progress.SecondaryTotal = total;
            progress.SecondaryValue = i;
            mypercent = (i * 100) / total;
            progress.SecondaryPercent = Math.Round(mypercent, 2);
            progress.CurrentOperationText = "Step " + i.ToString();
            System.Threading.Thread.Sleep(30);
        }
    }

    Thanks,
    Princy. 
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Jordi
    Jordi avatar
    2 posts
    Member since:
    Jun 2012

    Posted 29 Jul 2014 in reply to Princy Link to this post

    Locale that you are using?

    Try it with Spanish localization.

    I think the progress bar is interpreting of 10,23 as 1023

    If I do the test with American location if I work.

    My message is not to ask for a solution (and I've found the solution by rounding the value.) was only an appreciation for I have lost a lot of time until I find the reason.

    progress.SecondaryTotal = datatable.Rows.Count;
     
    foreach (DataRow row in datatable.Rows)
    {
        NumReg++;
     
        double porcentage = ((double)NumReg / (double)datatable.Rows.Count) * 100;
        progress.SecondaryValue = NumReg;
        progress.SecondaryPercent = Math.Round(porcentage, 0);
     
        if (Response.IsClientConnected)
        {
                           ......
            System.Threading.Thread.Sleep(100);
     
        }
    ....

    thank you very much
Back to Top