Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
More grid woes
Message
From
07/07/2005 07:51:53
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
06/07/2005 13:50:59
General information
Forum:
ASP.NET
Category:
WebForms
Title:
Environment versions
Environment:
ASP.NET
OS:
Windows XP SP2
Network:
Windows 2000 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01029008
Message ID:
01029873
Views:
12
>>Alex,
>>Yeah not only Iformatprovider but .Net help is as clear as mud:)
>>Try:
>>
>> dr[1]	= double.Parse(sValue, NumberStyles.Currency);
>>
>>PS: Add System.Globalization to using directives.
>>Cetin

>
>That certainly pointed me in the right direction. Changing the column format to string
>
>dt.Columns.Add(new DataColumn("Value", typeof(String)));
>
>and then later on
>
>dr[1] = double.Parse(sValue, NumberStyles.Currency).ToString("C");
>
>did it. They now show as currency in the grid even though it is entered as double. Go figure. But at least I can show the user now.
>
>Thanks!

You made kind of calculated field:) However you could do that keeping the column as double. Something like:
BoundColumn bc = new BoundColumn();
bc.DataField = "Value";
bc.HeaderText="Price";
bc.ItemStyle.HorizontalAlign=HorizontalAlign.Right;
bc.DataFormatString="{0:C2}"; // Format parameter 0 as currency with 2 decimal places
myDataGrid.Columns.Add(bc);
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform