BadFormad DataFormatString "{0:0.##}" + " %" C1GridView 2025v2 399

Posted by: enrique.pv-ext on 21 May 2026, 10:40 am EST

  • Posted 21 May 2026, 10:40 am EST

    Hi,

    Migrate from 2010v1 to 2025v2 399 in ASP.NET WebForms NET Framework 4.8.1.

    Using C1GridView from C1.Web.Wijmo.Controls.48.dll

    DataFormatString = "{0:0.##}" + " %";

    My code:

        f = new C1BoundField();
        f = GetC1BoundField(210, (string)this._textsShown[5], "P", "P", TableItemStyle);
        f.DataFormatString = "{0:0.##}" + " %";
        f.ItemStyle.HorizontalAlign = HorizontalAlign.Right;
        C1GridView1.Columns.Add(f);

    f.DataFormatString = “{0:#,##0}”;

    can be n0 or c2

    Any suggestions for “{0:0.##}” + " %"; ?

  • Posted 22 May 2026, 3:31 am EST

    Hello Enrique,

    It seems that you want to format numerical values as percentages. If so, you can use the “p” format specifier. It works similarly to “n” or “c”, but is specifically used for percentage formatting.

    Please note that when a numerical value is formatted using “p”, it is automatically multiplied by 100 before the ‘%’ symbol is applied.

    Sample: GridView_PercentFormat.zip

    Regards,

    Uttkarsh.

  • Posted 25 May 2026, 3:34 am EST - Updated 25 May 2026, 3:40 am EST

    I try with p, p0, p1…

    f.DataFormatString = "p1"; // "{0:0.##}" + " %"; //  when a numerical value is formatted using “p”, it is automatically multiplied by 100 before the ‘%’ symbol is applied.

    p

    p0

    p1

    In older version: “{0:0.##}” + " %";

    any suggestions, for view right the percentage value ?

  • Posted 26 May 2026, 3:11 am EST

    Hello Enrique,

    As mentioned earlier, when using the “p” format specifier, the value is automatically multiplied by 100 before the “%” symbol is appended. Therefore, the behavior you are seeing is expected.

    For your scenario, one possible workaround is to divide the underlying values by 100 before binding them to the grid, and then use the percentage format specifier.

    If this approach does not meet your requirements, please share a small sample of the data being bound to the grid along with the relevant C1-specific code used in your project. This will help us better understand the scenario and suggest the most appropriate solution.

    Regards,

    Uttkarsh

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels