Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Visual Studio.NET / General / November 2003

Tip: Looking for answers? Try searching our database.

decimal places

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
LW Irving - 07 Nov 2003 07:01 GMT
I use the  C# statement below in an aspx page to show a price

<%# AuctionRow["min_bid"].ToString() == "" ? AuctionRow["pay"] :
AuctionRow["min_bid"] %>

but it displays with 4 decimal decimal places

I thought AuctionRow["min_bid"].ToString("C") would give me 2 places but it
gives a compilation error

CS1501: No overload for method 'ToString' takes '1' arguments

in the aspx.cs i am using

using System.Globalization;

and in web.config  file i have

<globalization culture="en-AU" uiCulture="en" requestEncoding="UTF-8"
responseEncoding="UTF-8" fileEncoding="UTF-8"/>

in the system.web section

Can any one tell me where and what I need to add to get the string to
display as currency

Thanks

Wayne
Yves Tourchot - 07 Nov 2003 15:41 GMT
> I use the  C# statement below in an aspx page to show a price
>
[quoted text clipped - 7 lines]
>
> CS1501: No overload for method 'ToString' takes '1' arguments

try:
   AuctionRow["min_bid"].ToString("C",NumberFormatInfo.CurrentInfo)

> in the aspx.cs i am using
>
[quoted text clipped - 13 lines]
>
> Wayne
LW Irving - 08 Nov 2003 08:26 GMT
Yves
thanks for the reply
I get the error below when I try your suggestion
CS0103: The name 'NumberFormatInfo' does not exist in the class or namespace
'ASP.ViewAuction_aspx'

Can I add a class to a aspx page or do I need to put the code on the aspx.cs
page and then display the label on the aspx page
Is NumberFormatInfo a part of System.Globalization or does it need a
seperate definition
Sorry but I am pretty new to .net and c#

Regards
Wayne

> > I use the  C# statement below in an aspx page to show a price
> >
[quoted text clipped - 29 lines]
> >
> > Wayne
Yves Tourchot - 10 Nov 2003 17:48 GMT
> Yves
> thanks for the reply
> I get the error below when I try your suggestion
> CS0103: The name 'NumberFormatInfo' does not exist in the class or namespace
> 'ASP.ViewAuction_aspx'

'ASP.ViewAuction_aspx' is probably where your class or control AuctionRow[]
is defined.

You should look at the definition  of your class or control AuctionRow[]. It
should probably override the ToString method.
You could add your own overload member to fulfill your need.

> Can I add a class to a aspx page or do I need to put the code on the aspx.cs
> page and then display the label on the aspx page
> Is NumberFormatInfo a part of System.Globalization or does it need a
> seperate definition

Yes, NumberFormatInfo is part of System.Globalization.

> Sorry but I am pretty new to .net and c#
>
[quoted text clipped - 34 lines]
> > >
> > > Wayne

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.