473,383 Members | 1,803 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,383 software developers and data experts.

DataFormatString question

I have a Gridview that I want to format the values so it looks like this.

Currently What I Want
25.6 25.60%
1.2 1.20%
100 100.00%

Basically, I always want two zeros after the decimal.
I know {0:c} does currency and {0:d} does dates. What converts decimals?

According to this site, I'm suppose to use {0:d} which is already taken by
date.
http://msdn.microsoft.com/en-us/libr...matstring.aspx

Nov 11 '08 #1
1 1233
"pvong" <phillip*at*yahoo*dot*comwrote in message
news:%2***************@TK2MSFTNGP06.phx.gbl...
Basically, I always want two zeros after the decimal.
I know {0:c} does currency and {0:d} does dates. What converts decimals?

According to this site, I'm supposed to use {0:d} which is already taken
by date.
http://msdn.microsoft.com/en-us/libr...matstring.aspx
No. If you read the site again carefully, you'll see that what you're
supposed to use is {0:D}, not {0:d}
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Nov 11 '08 #2

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

Similar topics

1
by: Jac | last post by:
Hey, I do a databinding and use the following <asp:datagrid .....> .... <asp:BoundColumn DataField="f1" HeaderText... DataFormatString="{0:d}">.. This works fine for a date. Now, I have...
1
by: frank | last post by:
I am using the DataFormatString property on BoundColumn objects in a DataGrid, but they don't seem to work for some reason. I copied them straight from another DataGrid where they work fine, but...
9
by: Roy | last post by:
Hey all, Ok, I have a boundcolumn in a datagrid which displays a smalldatetime field from a table. Behold: <asp:BoundColumn DataField="final_appvl_dt" SortExpression="final_appvl_dt"...
0
by: .Net Sports | last post by:
I'm trying to display a figure in my datagrid as a currency ($100.00), but I can't use DataFormatString inside templatecolumn, itemstyle, or itemtemplate (as they imply that no attribute named...
3
by: Gerhard Pretorius | last post by:
Since installing the VS.NET August CTP the DataFormatString of the BoundField in the Gridview does not work. Runtime v2.0.50727. <asp:BoundField DataField="Event_Date"...
1
by: Randall Parker | last post by:
In ASP.Net v1.1 and C# suppose one has: protected System.Web.UI.WebControls.DataGrid MyGrid; In Page_Load I want to do the equivalent of: MyGrid.Columns.DataFormatString="{0:d}"; or ...
1
by: Hardy Wang | last post by:
Hi, I have a GridView control in my web form (ASP.NET 2.0) <asp:GridView ID="gvReport" runat="server" AllowSorting="True" AutoGenerateColumns="False" Width="100%"> <HeaderStyle...
3
by: Meelis Lilbok | last post by:
Hi Im using VB and ASP.NET2. In DataGrid column is use DataFormatString="{0:dd.MM.yyyy}" but it's not working :(( for example it displays always also 00:00:00 (houers, minutes and seconds)...
2
by: Rob Roberts | last post by:
I have a GridView that is bound to a collection of DateTimes (i.e. - Collection<DateTime>). I have a BoundField in the GridView, and its DataField is set to the DateTime's Date property, and the...
5
by: Tim Mackey | last post by:
hi, with a derived DataGrid control, i can override the CreateColumnSet method and scan into the DataGridColumns and set the DataFormatString, e.g. leave out the time part of a DateTime value. ...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...

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.