473,796 Members | 2,532 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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
DataFormatStrin g
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 1562
Hi Shimon,

As for the GridView DataField's DataFormatStrin g 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 DataFormatStrin g from
working. So I think you can try disabling the "HtmlEncode " on that
DataField so as to make DataFormatStrin g take effect, e.g:

<asp:BoundFie ld DataField="Orde rDate" HeaderText="Ord erDate"
SortExpression= "OrderDate" DataFormatStrin g="{0:yy/mm/dd}"
HtmlEncode="fal se"/>

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**********@c ommunity.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.publi c.dotnet.framew ork.aspnet
| NNTP-Posting-Host: ool-44c05922.dyn.op tonline.net 68.192.89.34
| Path: TK2MSFTNGXA02.p hx.gbl!TK2MSFTN GP08.phx.gbl!TK 2MSFTNGP10.phx. gbl
| Xref: TK2MSFTNGXA02.p hx.gbl
microsoft.publi c.dotnet.framew ork.aspnet:3606 19
| X-Tomcat-NG: microsoft.publi c.dotnet.framew ork.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
| DataFormatStrin g
| 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******** ******@TK2MSFTN GXA02.phx.gbl.. .
Hi Shimon,

As for the GridView DataField's DataFormatStrin g 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 DataFormatStrin g from
working. So I think you can try disabling the "HtmlEncode " on that
DataField so as to make DataFormatStrin g take effect, e.g:

<asp:BoundFie ld DataField="Orde rDate" HeaderText="Ord erDate"
SortExpression= "OrderDate" DataFormatStrin g="{0:yy/mm/dd}"
HtmlEncode="fal se"/>

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**********@c ommunity.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.publi c.dotnet.framew ork.aspnet
| NNTP-Posting-Host: ool-44c05922.dyn.op tonline.net 68.192.89.34
| Path: TK2MSFTNGXA02.p hx.gbl!TK2MSFTN GP08.phx.gbl!TK 2MSFTNGP10.phx. gbl
| Xref: TK2MSFTNGXA02.p hx.gbl
microsoft.publi c.dotnet.framew ork.aspnet:3606 19
| X-Tomcat-NG: microsoft.publi c.dotnet.framew ork.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
| DataFormatStrin g
| 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**********@c ommunity.nospam > wrote in message
news:eI******** ******@TK2MSFTN GP10.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
DataFormatStrin g
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******** ******@TK2MSFTN GXA02.phx.gbl.. .
Hi Shimon,

As for the GridView DataField's DataFormatStrin g 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 DataFormatStrin g from
working. So I think you can try disabling the "HtmlEncode " on that
DataField so as to make DataFormatStrin g take effect, e.g:

<asp:BoundFie ld DataField="Orde rDate" HeaderText="Ord erDate"
SortExpression= "OrderDate" DataFormatStrin g="{0:yy/mm/dd}"
HtmlEncode="fal se"/>

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**********@c ommunity.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.publi c.dotnet.framew ork.aspnet
| NNTP-Posting-Host: ool-44c05922.dyn.op tonline.net 68.192.89.34
| Path: TK2MSFTNGXA02.p hx.gbl!TK2MSFTN GP08.phx.gbl!TK 2MSFTNGP10.phx. gbl
| Xref: TK2MSFTNGXA02.p hx.gbl
microsoft.publi c.dotnet.framew ork.aspnet:3606 19
| X-Tomcat-NG: microsoft.publi c.dotnet.framew ork.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
| DataFormatStrin g
| 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**********@c ommunity.nospam >
| References: <eI************ **@TK2MSFTNGP10 .phx.gbl>
<XO************ **@TK2MSFTNGXA0 2.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.publi c.dotnet.framew ork.aspnet
| NNTP-Posting-Host: ool-44c05922.dyn.op tonline.net 68.192.89.34
| Path: TK2MSFTNGXA02.p hx.gbl!TK2MSFTN GP08.phx.gbl!TK 2MSFTNGP14.phx. gbl
| Xref: TK2MSFTNGXA02.p hx.gbl
microsoft.publi c.dotnet.framew ork.aspnet:3607 26
| X-Tomcat-NG: microsoft.publi c.dotnet.framew ork.aspnet
|
| Thank you,
| that worked.
| Shimon.
|
|
| "Steven Cheng[MSFT]" <st*****@online .microsoft.com> wrote in message
| news:XO******** ******@TK2MSFTN GXA02.phx.gbl.. .
| > Hi Shimon,
| >
| > As for the GridView DataField's DataFormatStrin g 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 DataFormatStrin g from
| > working. So I think you can try disabling the "HtmlEncode " on that
| > DataField so as to make DataFormatStrin g take effect, e.g:
| >
| > <asp:BoundFie ld DataField="Orde rDate" HeaderText="Ord erDate"
| > SortExpression= "OrderDate"
DataFormatStrin g="{0:yy/mm/dd}"
| > HtmlEncode="fal se"/>
| >
| > 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**********@c ommunity.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.publi c.dotnet.framew ork.aspnet
| > | NNTP-Posting-Host: ool-44c05922.dyn.op tonline.net 68.192.89.34
| > | Path: TK2MSFTNGXA02.p hx.gbl!TK2MSFTN GP08.phx.gbl!TK 2MSFTNGP10.phx. gbl
| > | Xref: TK2MSFTNGXA02.p hx.gbl
| > microsoft.publi c.dotnet.framew ork.aspnet:3606 19
| > | X-Tomcat-NG: microsoft.publi c.dotnet.framew ork.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
| > | DataFormatStrin g
| > | 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
3023
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
9819
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 a C++ std::ostream: printf( " %-20s %-8.8s %08x %06x %02x %-3.3s %02x %04x %02x\n", i, std::string( pSec->GetName() ).substr( 0, 20 ).c_str(), SectionTypes( pSec->GetType() ).c_str(), pSec->GetAddress(), pSec->GetSize(),
1
10225
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 the document with PreserveWhiteSpace = true.) I thought I could do this by using an XmlTextWriter with Formatting set to Formatting.Indented, but this doesn't work. The Formatting.Indented on the XmlTextWriter only indents my output when I...
4
4160
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 want all of the controls in whatever is the CURRENT record to have it's data bolded on the screen. (Question #1: Is there a SIMPLE way to refer to the Current Record?) I've been trying to use a Bookmark to specify the current record, but it
1
5017
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 "MyField1" is True. No problem, I just need to write "Expression is" and " = -1 "
10
3164
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 ld_tot_pet_clean_fee_calc As Double ld_tot_pet_clean_fee_calc = li_net_total_calc * 0.0075 ld_tot_pet_clean_fee = lo_misc_func.FormatMC(ld_tot_pet_clean_fee_calc, "D") Session("tot_pet_clean_fee") = lo_misc_func.FormatMC(ld_tot_pet_clean_fee, "D")...
25
2711
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" long input lines into 2 or more shorter lines before the nth column... etc etc. Now, there are numerous anwers on the web and in the "C answer book", which includes a function to expand the tabs to blanks ( depending upon where the tab is in...
14
4361
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 unformatted data values (as decimals) just fine, so I know there's not a problem with the data retrieval, just the formatting. I have read that this would work: lblPrice.Text = prodRow.ToString("C");
2
3322
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 current value, I set its background color. No problem with this part. My problem is that when clicking different text boxes representing the records on the continuous form, the left and the right margin areas do not always take on the background...
0
9679
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10453
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
10223
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...
0
10003
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
9050
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6785
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5441
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...
2
3730
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2924
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.