ToString format

B

Brent Jenny

I have the following function that takes in a string, converts it to a
double and adds it to a running total. I wnat to format it on return
to mey datagrid template column as currency. iget the following build
error The best overloaded method match for
'string.ToString(System.IFormatProvider)' has some invalid arguments.
The error happens on my return statement. Any ideas?



public string po_count(string po)
{
double tmp_dbl = double.Parse(po);
myPoTotal += tmp_dbl;

return po.ToString("C");
}

The following is my template column code.

<asp:TemplateColumn HeaderText="JO Order Value">
<ItemStyle Font-Size="8pt"></ItemStyle>
<ItemTemplate>
<%# po_count(DataBinder.Eval(Container.DataItem,
"po_price").ToString()) %>
</ItemTemplate>
</asp:TemplateColumn>
 
I

Ivan

Use the .ToString("C") with DOUBLE values, not STRING.
With string values, to tostring() method with a parameter
string that represent a format.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,051
Latest member
CarleyMcCr

Latest Threads

Top