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

DataFormatString - hiding data :(

4 Answers 101 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Milan Gurung
Top achievements
Rank 1
Milan Gurung asked on 28 Jan 2009, 12:55 PM
Hi,

I am having a senior moment or something like that -  Following is the partial grid code used to display a ClientCost field. The data coming back from database is 0.00. It has rendered it as if someone has used a eraser in the place where 0.00 should be displayed. If I remove DataFormatString and FooterAggregateFormatString then everything looks fine.

Could you please let me know why it is happening?

<telerik:GridBoundColumn DataField="ClientCost" HeaderText="Net Cost" Aggregate="Sum"  DataFormatString="{0:###,###.##}"   FooterAggregateFormatString="&lt;strong&gt;{0:###,###.##}&lt;/strong&gt;"  UniqueName="ClientCost" Groupable="False"></telerik:GridBoundColumn>

Thanks a lot.

Milan G

4 Answers, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 28 Jan 2009, 02:18 PM
Hello Milan,

I recommend you test the following code and compare the results.
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" /> 

RadAjaxManager1.Alert(String.Format("{0:###,###.##}", (decimal)0.0)); 

I also suggest you try another approach: DataFormatString="{0:000,000.00}"
RadAjaxManager1.Alert(String.Format("{0:000,000.00}", (decimal)100.01)); 

Please let us know if you have more questions.

Kind regards,
Daniel
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Milan Gurung
Top achievements
Rank 1
answered on 28 Jan 2009, 02:32 PM
Hi Daniel,

I checked the supplied codesnippet. If I tried to alert (0.0) then alert window shows blank and and if you alert number like 0.233 0r 12.23 it works.
This gives me the impression that dataformatstring is considering 0.00 as blank which is a undesirable feature. Is there any way to avoid.

Thanks a lot.
Milan G
0
Accepted
Daniel
Telerik team
answered on 28 Jan 2009, 02:40 PM
Hello Milan,

It depends on the behavior you want to achieve. Please test the following code on your end and let me know whether it helps:
RadAjaxPanel1.Alert(String.Format("{0:###,##0.0#}", (decimal)10000.0)); 

Best regards,
Daniel
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Milan Gurung
Top achievements
Rank 1
answered on 28 Jan 2009, 02:51 PM
Many thanks Daniel.  It works.

Cheers,
Milan G
Tags
Grid
Asked by
Milan Gurung
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Milan Gurung
Top achievements
Rank 1
Share this question
or