Wrox Programmer Forums
|
Visual Web Developer 2005 Discuss creating ASP.NET 2.0 sites with Microsoft's Visual Web Developer 2005. If your question is more specific to a piece of code than the Visual tool, see the ASP.NEt 2.0 forums instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Visual Web Developer 2005 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 17th, 2006, 03:11 PM
Authorized User
 
Join Date: Feb 2006
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default GridView Formatting

I am trying to get a column in a GridView to format like:
$33.00. I am putting the following into the DataStringFormat;
${0:#,##0.00} and it still won't produce zero's after the decimal.

If the value is $3 I want it to show $3.00.

Any thoughts?

Chris

 
Old March 18th, 2006, 04:16 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi Chris,

Besides the DataFormatString, you also need to set the column's HtmlEncode property to false, like this:

<asp:BoundField DataField="Price" HeaderText="Price"
    HtmlEncode="false" SortExpression="Price"
    DataFormatString="{0:c}"
>

HtH,

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
 
Old March 18th, 2006, 11:34 AM
Authorized User
 
Join Date: Feb 2006
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks, I'll try that.

Chris






Similar Threads
Thread Thread Starter Forum Replies Last Post
Get GridView Cell Value Based on GridView Column stublair C# 2008 aka C# 3.0 0 September 4th, 2008 08:30 AM
GridView - Phone column formatting jnks2005 ASP.NET 2.0 Basics 1 February 14th, 2007 06:36 PM
Formatting Fields In GridView len1591 ASP.NET 2.0 Basics 2 December 29th, 2005 09:38 PM
Formatting syrex XSLT 2 November 5th, 2005 08:23 AM
Formatting Ben Access 3 February 28th, 2004 05:52 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.