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

DataFormatString="{0:G29}" should trim trailing zero's but does not

2 Answers 1163 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Cynthia
Top achievements
Rank 1
Cynthia asked on 26 Mar 2009, 03:09 PM
I have a column in my grid which holds a tonnage amount.  I wanted to trim the trailing zero's and so I used the following syntax for the column:

<telerik:GridBoundColumn 
    DataField="Tonnage_Ordered" 
    UniqueName="Tonnage_Ordered" 
    DataType="System.Decimal" 
    DataFormatString="{0:G29}" 
    HeaderText="Tonnage" />

When the page is initially loaded the formating works.  I am setting the datasource server side.  When I try to refresh the grid by client side data binding I get the following error message:

Microsoft JScript runtime error: Sys.FormatException: Format specifier was invalid.

Should I be using a different DataStringFormat or will Telerik be fixing this?

Regards,
Cynthia

2 Answers, 1 is accepted

Sort by
0
Accepted
Pavel
Telerik team
answered on 31 Mar 2009, 11:36 AM
Hello Cynthia,

I am afraid that this format string is not supported by ASP.NET AJAX. You can read more about it here.

Kind regards,
Pavel
the Telerik team

Check out Telerik Trainer , the state of the art learning tool for Telerik products.
0
Cynthia
Top achievements
Rank 1
answered on 31 Mar 2009, 06:21 PM
Hi Pavel,

Thank you for your response.  I have decided to use DataFormatString="{0:N3}", which shows my total posible decimals (3).

Regards,
Cynthia
Tags
Grid
Asked by
Cynthia
Top achievements
Rank 1
Answers by
Pavel
Telerik team
Cynthia
Top achievements
Rank 1
Share this question
or