Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
More grid woes
Message
De
07/07/2005 07:51:53
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
À
06/07/2005 13:50:59
Information générale
Forum:
ASP.NET
Catégorie:
WebForms
Titre:
Versions des environnements
Environment:
ASP.NET
OS:
Windows XP SP2
Network:
Windows 2000 Server
Database:
MS SQL Server
Divers
Thread ID:
01029008
Message ID:
01029873
Vues:
13
>>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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform