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

GredView {0:d} formatting doesn't work

I just don't understand what is wrong.
I have simple query. One of the returning fields is data

I created bound column for GridView (ASP.NET 2.0) and specified
DataFormatString
as {0:d} - it returns me the row date with hours.
I tried something like this {0 :dd/MM/yyyy} the same results.
It looks like that system doesn't recognize that the field is date. Why not?
What can be done?
Thank you,
Shimon
Nov 24 '05 #1
5 1551
Hi Shimon,

As for the GridView DataField's DataFormatString not working problem, I
think it is because the new "HtmlEncode" setting provided for the
DataField. This property is set to "true" by default, thus the bound data
on that column will be htmlencoded before render out to response stream...
And set Htmlencode to true will prevent the DataFormatString from
working. So I think you can try disabling the "HtmlEncode" on that
DataField so as to make DataFormatString take effect, e.g:

<asp:BoundField DataField="OrderDate" HeaderText="OrderDate"
SortExpression="OrderDate" DataFormatString="{0:yy/mm/dd}"
HtmlEncode="false"/>

Hope helps. Thanks,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

--------------------
| From: "Shimon Sim" <sh**********@community.nospam>
| Subject: GredView {0:d} formatting doesn't work
| Date: Wed, 23 Nov 2005 22:51:45 -0500
| Lines: 13
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2900.2670
| X-RFC2646: Format=Flowed; Original
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2670
| Message-ID: <eI**************@TK2MSFTNGP10.phx.gbl>
| Newsgroups: microsoft.public.dotnet.framework.aspnet
| NNTP-Posting-Host: ool-44c05922.dyn.optonline.net 68.192.89.34
| Path: TK2MSFTNGXA02.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFT NGP10.phx.gbl
| Xref: TK2MSFTNGXA02.phx.gbl
microsoft.public.dotnet.framework.aspnet:360619
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
|
| I just don't understand what is wrong.
| I have simple query. One of the returning fields is data
|
| I created bound column for GridView (ASP.NET 2.0) and specified
| DataFormatString
| as {0:d} - it returns me the row date with hours.
| I tried something like this {0 :dd/MM/yyyy} the same results.
| It looks like that system doesn't recognize that the field is date. Why
not?
| What can be done?
| Thank you,
| Shimon
|
|
|

Nov 24 '05 #2
Super!
Had the same trouble :)
"Steven Cheng[MSFT]" <st*****@online.microsoft.com> schreef in bericht
news:XO**************@TK2MSFTNGXA02.phx.gbl...
Hi Shimon,

As for the GridView DataField's DataFormatString not working problem, I
think it is because the new "HtmlEncode" setting provided for the
DataField. This property is set to "true" by default, thus the bound data
on that column will be htmlencoded before render out to response stream...
And set Htmlencode to true will prevent the DataFormatString from
working. So I think you can try disabling the "HtmlEncode" on that
DataField so as to make DataFormatString take effect, e.g:

<asp:BoundField DataField="OrderDate" HeaderText="OrderDate"
SortExpression="OrderDate" DataFormatString="{0:yy/mm/dd}"
HtmlEncode="false"/>

Hope helps. Thanks,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

--------------------
| From: "Shimon Sim" <sh**********@community.nospam>
| Subject: GredView {0:d} formatting doesn't work
| Date: Wed, 23 Nov 2005 22:51:45 -0500
| Lines: 13
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2900.2670
| X-RFC2646: Format=Flowed; Original
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2670
| Message-ID: <eI**************@TK2MSFTNGP10.phx.gbl>
| Newsgroups: microsoft.public.dotnet.framework.aspnet
| NNTP-Posting-Host: ool-44c05922.dyn.optonline.net 68.192.89.34
| Path: TK2MSFTNGXA02.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFT NGP10.phx.gbl
| Xref: TK2MSFTNGXA02.phx.gbl
microsoft.public.dotnet.framework.aspnet:360619
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
|
| I just don't understand what is wrong.
| I have simple query. One of the returning fields is data
|
| I created bound column for GridView (ASP.NET 2.0) and specified
| DataFormatString
| as {0:d} - it returns me the row date with hours.
| I tried something like this {0 :dd/MM/yyyy} the same results.
| It looks like that system doesn't recognize that the field is date. Why
not?
| What can be done?
| Thank you,
| Shimon
|
|
|

Nov 24 '05 #3
note sure if this is by design of if it is a bug, but turn of HTML Encoding.
Your data will format.
--

Andrew Robinson
www.binaryocean.com
www.bellinghamdotnet.org
"Shimon Sim" <sh**********@community.nospam> wrote in message
news:eI**************@TK2MSFTNGP10.phx.gbl...
I just don't understand what is wrong.
I have simple query. One of the returning fields is data

I created bound column for GridView (ASP.NET 2.0) and specified
DataFormatString
as {0:d} - it returns me the row date with hours.
I tried something like this {0 :dd/MM/yyyy} the same results.
It looks like that system doesn't recognize that the field is date. Why
not? What can be done?
Thank you,
Shimon

Nov 24 '05 #4
Thank you,
that worked.
Shimon.
"Steven Cheng[MSFT]" <st*****@online.microsoft.com> wrote in message
news:XO**************@TK2MSFTNGXA02.phx.gbl...
Hi Shimon,

As for the GridView DataField's DataFormatString not working problem, I
think it is because the new "HtmlEncode" setting provided for the
DataField. This property is set to "true" by default, thus the bound data
on that column will be htmlencoded before render out to response stream...
And set Htmlencode to true will prevent the DataFormatString from
working. So I think you can try disabling the "HtmlEncode" on that
DataField so as to make DataFormatString take effect, e.g:

<asp:BoundField DataField="OrderDate" HeaderText="OrderDate"
SortExpression="OrderDate" DataFormatString="{0:yy/mm/dd}"
HtmlEncode="false"/>

Hope helps. Thanks,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

--------------------
| From: "Shimon Sim" <sh**********@community.nospam>
| Subject: GredView {0:d} formatting doesn't work
| Date: Wed, 23 Nov 2005 22:51:45 -0500
| Lines: 13
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2900.2670
| X-RFC2646: Format=Flowed; Original
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2670
| Message-ID: <eI**************@TK2MSFTNGP10.phx.gbl>
| Newsgroups: microsoft.public.dotnet.framework.aspnet
| NNTP-Posting-Host: ool-44c05922.dyn.optonline.net 68.192.89.34
| Path: TK2MSFTNGXA02.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFT NGP10.phx.gbl
| Xref: TK2MSFTNGXA02.phx.gbl
microsoft.public.dotnet.framework.aspnet:360619
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
|
| I just don't understand what is wrong.
| I have simple query. One of the returning fields is data
|
| I created bound column for GridView (ASP.NET 2.0) and specified
| DataFormatString
| as {0:d} - it returns me the row date with hours.
| I tried something like this {0 :dd/MM/yyyy} the same results.
| It looks like that system doesn't recognize that the field is date. Why
not?
| What can be done?
| Thank you,
| Shimon
|
|
|

Nov 24 '05 #5
You're welcome Shimon,

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

--------------------
| From: "Shimon Sim" <sh**********@community.nospam>
| References: <eI**************@TK2MSFTNGP10.phx.gbl>
<XO**************@TK2MSFTNGXA02.phx.gbl>
| Subject: Re: GredView {0:d} formatting doesn't work
| Date: Thu, 24 Nov 2005 09:15:51 -0500
| Lines: 68
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2900.2670
| X-RFC2646: Format=Flowed; Original
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2670
| Message-ID: <eC**************@TK2MSFTNGP14.phx.gbl>
| Newsgroups: microsoft.public.dotnet.framework.aspnet
| NNTP-Posting-Host: ool-44c05922.dyn.optonline.net 68.192.89.34
| Path: TK2MSFTNGXA02.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFT NGP14.phx.gbl
| Xref: TK2MSFTNGXA02.phx.gbl
microsoft.public.dotnet.framework.aspnet:360726
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
|
| Thank you,
| that worked.
| Shimon.
|
|
| "Steven Cheng[MSFT]" <st*****@online.microsoft.com> wrote in message
| news:XO**************@TK2MSFTNGXA02.phx.gbl...
| > Hi Shimon,
| >
| > As for the GridView DataField's DataFormatString not working problem, I
| > think it is because the new "HtmlEncode" setting provided for the
| > DataField. This property is set to "true" by default, thus the bound
data
| > on that column will be htmlencoded before render out to response
stream...
| > And set Htmlencode to true will prevent the DataFormatString from
| > working. So I think you can try disabling the "HtmlEncode" on that
| > DataField so as to make DataFormatString take effect, e.g:
| >
| > <asp:BoundField DataField="OrderDate" HeaderText="OrderDate"
| > SortExpression="OrderDate"
DataFormatString="{0:yy/mm/dd}"
| > HtmlEncode="false"/>
| >
| > Hope helps. Thanks,
| >
| > Steven Cheng
| > Microsoft Online Support
| >
| > Get Secure! www.microsoft.com/security
| > (This posting is provided "AS IS", with no warranties, and confers no
| > rights.)
| >
| >
| >
| > --------------------
| > | From: "Shimon Sim" <sh**********@community.nospam>
| > | Subject: GredView {0:d} formatting doesn't work
| > | Date: Wed, 23 Nov 2005 22:51:45 -0500
| > | Lines: 13
| > | X-Priority: 3
| > | X-MSMail-Priority: Normal
| > | X-Newsreader: Microsoft Outlook Express 6.00.2900.2670
| > | X-RFC2646: Format=Flowed; Original
| > | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2670
| > | Message-ID: <eI**************@TK2MSFTNGP10.phx.gbl>
| > | Newsgroups: microsoft.public.dotnet.framework.aspnet
| > | NNTP-Posting-Host: ool-44c05922.dyn.optonline.net 68.192.89.34
| > | Path: TK2MSFTNGXA02.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFT NGP10.phx.gbl
| > | Xref: TK2MSFTNGXA02.phx.gbl
| > microsoft.public.dotnet.framework.aspnet:360619
| > | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
| > |
| > | I just don't understand what is wrong.
| > | I have simple query. One of the returning fields is data
| > |
| > | I created bound column for GridView (ASP.NET 2.0) and specified
| > | DataFormatString
| > | as {0:d} - it returns me the row date with hours.
| > | I tried something like this {0 :dd/MM/yyyy} the same results.
| > | It looks like that system doesn't recognize that the field is date.
Why
| > not?
| > | What can be done?
| > | Thank you,
| > | Shimon
| > |
| > |
| > |
| >
|
|
|

Nov 25 '05 #6

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

Similar topics

5
by: Thomas Philips | last post by:
Consider the following simple dictionary e={1:'one', 2: 'two'} e >>>'one' However, If I attempt to print e using a formatted string print " %(1)s" %e, I get a KeyError: '1'
11
by: Steven T. Hatton | last post by:
OK, I take back the nasty stuff I said about printf. At least until I see a similarly concise way of writing this using C++ formatters. I want to convert the following to something I can put onto...
1
by: Riko Eksteen | last post by:
Hi I'm reading an xml file into an XmlDocument, adding some nodes, and writing it back out. I would like the nodes I add to assume the same level of indeting as the rest of the document. (I load...
4
by: DBQueen | last post by:
I have a subform which is in Continuous Forms view. I have added a button to the bottom of the page to move to the next record using the button wizard (result: DoCmd.GoToRecord , , acNext). I...
1
by: GGerard | last post by:
Hello Is there a way to use a variable in the Conditional Formatting of a Textbox? Example : I want the background of a textbox in a continuous form to change color when the value of...
10
by: Coleen | last post by:
Hi all :-) I have a weird formatting problem with an HTML table that I am populating using VB.Net and HTML. Here is the snippet of code for the cell I'm trying to format: Dim...
25
by: mdh | last post by:
Hi Group, Not looking for an answer, but more of an explanation. Thinking back to those heady days when you had the time to do them, may I ask this. Exercise 1-22 asks for a program to "fold"...
14
by: Scott M. | last post by:
Ok, this is driving me nuts... I am using VS.NET 2003 and trying to take an item out of a row in a loosely-typed dataset and place it in a label as a currency. As it is now, I am getting my...
2
by: robertng90025 | last post by:
I'm having a problem with MS Access 2003 and its conditional formatting. I have textboxes on a continuous form whose left and right margins are set to 0.03 inches. Based on each textbox's...
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?
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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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...
0
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,...
0
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...
0
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...
0
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...

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.