Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Basics
|
ASP.NET 2.0 Basics If you are new to ASP or ASP.NET programming with version 2.0, this is the forum to begin asking questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Basics 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 December 28th, 2005, 09:10 PM
Registered User
 
Join Date: Dec 2005
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default Formatting Fields In GridView

I am using formatting like this for currency and date

<asp:BoundField DataField="Cost" HeaderText="Cost" DataFormatString={0:C2} SortExpression="Cost" />
<asp:BoundField DataField="Dt" HeaderText="Dt" DataFormatString={0:d} SortExpression="Dt" />

Neither one works. What am I doing wrong? Please help!

 
Old December 29th, 2005, 05:17 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

You need to set HtmlEncode for the field to False.

When this attribute is True, then DataFormatString is not applied.

HtH,

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
 
Old December 29th, 2005, 09:38 PM
Registered User
 
Join Date: Dec 2005
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks a lot! It worked! :)






Similar Threads
Thread Thread Starter Forum Replies Last Post
GridView - Phone column formatting jnks2005 ASP.NET 2.0 Basics 1 February 14th, 2007 06:36 PM
Binding fields on a gridview aldwinenriquez ASP.NET 2.0 Professional 0 June 1st, 2006 07:50 PM
formatting memo fields in access database fskilnik Dreamweaver (all versions) 8 February 14th, 2006 06:24 PM
Using Forum fields select fields on the fly hellosureshkumar Crystal Reports 0 December 17th, 2004 08:20 AM





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