473,398 Members | 2,404 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

ToString format

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>
Nov 17 '05 #1
1 7070
Use the .ToString("C") with DOUBLE values, not STRING.
With string values, to tostring() method with a parameter
string that represent a format.
-----Original Message-----
I have the following function that takes in a string, converts it to adouble and adds it to a running total. I wnat to format it on returnto mey datagrid template column as currency. iget the following builderror 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>
.

Nov 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: aevans1108 | last post by:
expanding this message to microsoft.public.dotnet.xml Greetings Please direct me to the right group if this is an inappropriate place to post this question. Thanks. I want to format a...
7
by: BBFrost | last post by:
I'm receiving decimal values from database queries and placing them on a report page. The users want to see the following .... Db Value Display Value 123.3400 123.34...
8
by: G.Ashok | last post by:
Hi, I have created CultureInfo object and specified required digit grouping in it. The one of the overloaded ToString methods of Decimal type has parameters to format the value with required...
31
by: Zytan | last post by:
Everything (er, every class) in C# has ToString() which is conveniently automatically invoked when using it in Debug.WriteLine() or in a string concatenation, etc. I made a struct, and I want to...
12
by: ThunderMusic | last post by:
Hi, We have a part of our application that deals with millions of records and do some processing of them. We've achieved a pretty good performance gain by developping a custom DateTime.ToString...
5
by: Bob | last post by:
Hello Folks, I am bring backa data reader dr from the database/ So I have a number of fields such as dr To put this in a table I use "<td>" + dr.ToString() + "</td>" But I want to...
11
by: Gary James | last post by:
I'm using an object data type variable to pass a numeric value (Int, Float, Double, etc) to a function that returns a formatted string. However, nullable types do not provide an overridden...
6
by: Andy B | last post by:
I need to take the value of a textbox and format it in a more readable date. How do you do this? I tried textbox.text.tostring("date format string") but the compiler doesnt like that idea... any...
9
by: Hans-Jürgen Philippi | last post by:
Hi group, let's say I have a 'Person' class with properties like 'FirstName', 'LastName', 'Birthday' and so on. Now I overload the 'Person' ToString() method with an implementation...
2
by: Berryl Hesh | last post by:
I'm interested in how experienced.Net developers might handle routine display tasks as a general strategy. Let's say you have a use in your domain for value objects that encapsulate a person's...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.