473,698 Members | 2,554 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

format for decimal values

Hi All,

I have a decimal value on the GridView BoundField which comes from sql
server and it seems on gridview like that;
2096.62
14899.01

I want to display that values like
2.096,62
14.899,01

Thanks for any help
Jun 27 '08 #1
7 2056
On Jun 9, 11:50 am, "Nariban Barkan" <SomeFunny...@s .comwrote:
Hi All,

I have a decimal value on the GridView BoundField which comes from sql
server and it seems on gridview like that;
2096.62
14899.01

I want to display that values like
2.096,62
14.899,01

Thanks for any help
If you want to use locale-dependent group separator and decimal point,
then you need the "N" format specifier.
Jun 27 '08 #2
I have a decimal value on the GridView BoundField which comes from sql
server and it seems on gridview like that;
2096.62
14899.01

I want to display that values like
2.096,62
14.899,01

Convert to a double with Parse (or TryParse), then use ToString("N")
(or ToString("N",cu lture) if you want a culture other than the current one)

--
Mihai Nita [Microsoft MVP, Visual C++]
http://www.mihai-nita.net
------------------------------------------
Replace _year_ with _ to get the real email
Jun 27 '08 #3
Thanks all..

and can i add a special tag or a custom currency mark after or before the
value on the BoundField column ?


Jun 27 '08 #4
On Jun 9, 4:50*am, "Nariban Barkan" <SomeFunny...@s .comwrote:
Thanks all..

and can i add a special tag or a custom currency mark after or before the
value on the BoundField column ?
...or you can do format it in your sql server procedure... --for
example see :
http://www.siccolo.com/Articles/SQLS...-currency.html

I know that not everyone is fond of formatting on sql server side, but
it's just a suggestion...
... more at http://www.siccolo.com/articles.asp
Jun 27 '08 #5
On Jun 9, 12:50 pm, "Nariban Barkan" <SomeFunny...@s .comwrote:
Thanks all..

and can i add a special tag or a custom currency mark after or before the
value on the BoundField column ?
Then you need custom number format such as "#,##0.00't ag'" (note the
single quotes around 'tag' - they will ensure it is treated as a
literal string).
That's for CellFormatting event, though. For CellParsing, which you'll
also need for full two-way data binding, you'll probably want to trim
the tag/mark with String.Substrin g first, and then run it through
Decimal.Parse.

In general, I'd recommend searching MSDN for "Custom Numeric Format
Strings". It has more detailed explanations of what you can do with
this, and how.
Jun 27 '08 #6
Then you need custom number format such as "#,##0.00't ag'" (note the
single quotes around 'tag' - they will ensure it is treated as a
literal string).
Proper locale-aware formatting is done by setting
NumberFormatInf o.CurrencySymbo l and using ToString("C", ...)
A currency format is not just a number format with currency attached to it
(even in US -123 migh be represented as (123) when it's about financial
stuff)

--
Mihai Nita [Microsoft MVP, Visual C++]
http://www.mihai-nita.net
------------------------------------------
Replace _year_ with _ to get the real email
Jun 27 '08 #7
On Jun 11, 10:18 am, "Mihai N." <nmihai_year_2. ..@yahoo.comwro te:
Then you need custom number format such as "#,##0.00't ag'" (note the
single quotes around 'tag' - they will ensure it is treated as a
literal string).

Proper locale-aware formatting is done by setting
NumberFormatInf o.CurrencySymbo l and using ToString("C", ...)
A currency format is not just a number format with currency attached to it
(even in US -123 migh be represented as (123) when it's about financial
stuff)

--
Mihai Nita [Microsoft MVP, Visual C++]http://www.mihai-nita.net
------------------------------------------
Replace _year_ with _ to get the real email
That's assuming the original question was about locale-specific
currency formatting. However, the request was about "special tag or a
custom currency mark" - which, as I understand it, assumes that it is
not locale-dependent (and, indeed, may not be a currency sign at all,
merely something similar).
Jun 27 '08 #8

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

Similar topics

3
19227
by: stevek | last post by:
How do I format an integer. Add commas. 1234565 1,234,565 TIA
1
8857
by: Nick | last post by:
Well, the project I am working on has now come to a screeching halt! I have been developing a program that heavily utilizes ADO.NET record sets. To generate reports, I convert the recordset to XML, and then apply an XSLT to transform the XML into HTML. This works great (or did) until today. I just found out that the "number-format" command in XSLT can't handle scientific notation! So when I try to format these numbers I just get "NaN" on...
1
15472
by: Mike MacSween | last post by:
This looks like a bug to me. I have an expression on a report: =Format(Sum((**)*(/)),"0.00") Score is byte PercentOfGrade is double PropDegree is single ModuleCats is byte
1
7978
by: Terencetrent | last post by:
I am trying to format a query expression drawn from a dialog box as percent. The original statement to get the value for the query is as follows: New%markup: !! The dialog box looks the values up from a table called NewMarkup. It appears in the dialog box with a percent format. However, when I try to call that value in my query it shows it as a decimal.
2
1498
by: Hers2keep | last post by:
I have the following control on a report: "Total " & & " " & & " -- " & Format$(Sum(),"Standard") I can't use the simple way because of the concatenated fields. How can I force no decimal point on the Standard formatting? Thanks, Carla
7
5235
by: Sick | last post by:
My application populates a ListBox from a .TXT file. In the textfile there are prices with both dots as well as comma's for decimal indication. Example: 1234990; xg-tr-45; 1700,50; 0 2662666; hj-54-56; 1565.00; 0 8228880; 30-56-tw; 3295.50; 0 0022339; hs-sa-73; 2975,75; 0 .... etc
5
2206
by: Robin Tucker | last post by:
My database has a column for numeric data items. How can I use this number in the "format" command, such that for, say precision 2, I get numbers like 2011.01 or 2387.00 and for 4 I would get 2011.0100 or 2387.0000? (simple question I know!)
2
12508
by: AMDRIT | last post by:
Hello Everyone, I would like to format the Display Members of a combobox's datasource. Is there a way to apply a format without subclassing the original datasource? For example, given a list of decimal values, format them as currency values with a leading currency symbol and 2 decimal places. TIA Class Test
11
2251
by: RipperT | last post by:
Don't know if this group covers web apps, but here goes. In VS 2005, I am trying to get variables to hold thier values during postback from the server. I convert a text box's user-keyed value to an integer and assign it to a module level variable, then convert the variable and assign it to a hidden text box, setting it's EnableViewState to true so it returns with the reload. Then in the form's load event, I attempt to convert the contents...
2
6989
by: hunslair | last post by:
This is a really basic question. I am taking a teach yourself beginners course on Access 2003 and have run into a road block on one practice. In a select query, I have created a simple calculation field. Markup:(-)/ which is to formatted as Percent with 0 Decimal places. When I click into the Format box is am offered
0
8612
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9171
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9032
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8905
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8880
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
4373
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4625
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3053
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2008
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.