Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1360
JavaScript Crash after Editing "F"-formatted cell
posted

This is a simple bug to reproduce. I have a bound WHDG that has a cell formatted in the following way:

 

<

 

 

ig:BoundDataField DataFieldName="PL6_UNIT_COST" Key="PL6_UNIT_COST" Width="90px" DataFormatString="{0:f2}" CssClass="RIGHTp4"><Header Text="Unit Cost" CssClass="RIGHTp4"/></ig:BoundDataField>

 

 

The critical aspect of this is the DataFormatString. I need to have a fixed number of decimal placed on view and so i use the Standard .NET format "{0:fn}" where n ix the number of places after the decimal point. If you use "f" the cells format correctly for display but after editing such a cell a javascript error is generated. Inspection of the point of failure shows a routine that contains a number of formatting cases within a [Switch] statement and these include formats such as [c], [n], [p], [d] but not [f], hence the crash.

Any help gratefully received.

Paul

IG 2010.2
VS2010
ASP.NET C#
Dev Sys: Win 7 ULT 64

  • 1360
    Offline posted

    Ok Folks

    Answered my own question - use the "n" format, not "f". If you use: {0:n2} rather than {0:f2},all is well.

    Strange though that "f" is not supported given that it is a standard .NET formating code.

    Anyway, hope this helps somebody else.

    Paul