Click here to Skip to main content
13,199,852 members (66,498 online)
Rate this:
 
Please Sign up or sign in to vote.
See more:
Hi i having problems, when i try to format number in asp repeater. I am using Xpath and XMl datasource. It Does not say any error, but i just keeps it, without any decimals.
<asp:Repeater ID="rptCvrInfo" OnItemDataBound="rptCvrInfo_ItemDataBound" runat="server" DataSourceID="DataSource1">


<itemtemplate>




<asp:Label ID="lblEquity" Text='<%# FormatAmount( XPath("Equity") )%>' runat="server" />







My codebehind method
public static string FormatAmount(object In)
{
Decimal amount = Decimal.Parse(In.ToString(), new NumberFormatInfo() { NumberDecimalSeparator = "," });

return amount.ToString();

}
xmlnode from document
<Equity contextRef="ctx37" unitRef="DKK" decimals="-3">101015000

What I have tried:

Google, linq, databinder method, Eval
Posted 17-Jul-17 3:46am
Comments
j snooze 17-Jul-17 17:06pm
   
did you try putting a break point in your FormatAmount method to debug and verify its being called?
Martin Lauritsen 17-Jul-17 17:10pm
   
I did it inline using convert.Todecimal() i got Some Help in stark overflow. Stupid rookie mistake:)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy |
Web01 | 2.8.171020.1 | Last Updated 17 Jul 2017
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100