HighTechTalks DotNet Forums  

Format Date in Databound column

ASP.net Data Grid Control microsoft.public.dotnet.framework.aspnet.datagridcontrol


Discuss Format Date in Databound column in the ASP.net Data Grid Control forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
Vaughn Haybittle
 
Posts: n/a

Default Format Date in Databound column - 01-18-2007 , 11:03 AM






Hi,

I have a Gridview which is populated via a stored procedure. One of the
coumns returned is a date. The date is currently displayed as 18/01/2007
00:00:00. I just want to show the date without the time i.e. 18/01/2007. I
have tried adding a dataformatstring of {0:d} but it is not making any
difference.

Can anyone advise me on what I am doing wrong?

T.I.A.

Vaughn



Reply With Quote
  #2  
Old   
Eliyahu Goldin
 
Posts: n/a

Default Re: Format Date in Databound column - 01-18-2007 , 11:10 AM






Set HtmlEncode = false for the column.

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net


"Vaughn Haybittle" <vhaybittle (AT) mweb (DOT) co.za> wrote

Quote:
Hi,

I have a Gridview which is populated via a stored procedure. One of the
coumns returned is a date. The date is currently displayed as 18/01/2007
00:00:00. I just want to show the date without the time i.e. 18/01/2007.
I have tried adding a dataformatstring of {0:d} but it is not making any
difference.

Can anyone advise me on what I am doing wrong?

T.I.A.

Vaughn




Reply With Quote
  #3  
Old   
Vaughn Haybittle
 
Posts: n/a

Default Re: Format Date in Databound column - 01-18-2007 , 03:06 PM



Hi,

Thanks for the information. It worked perfectly. Can you please explain
briefly why changing this property made a difference.

Many thanks,

Vaughn


"Eliyahu Goldin" <REMOVEALLCAPITALSeEgGoldDinN (AT) mMvVpPsS (DOT) org> wrote in
message news:OQldwtxOHHA.4332 (AT) TK2MSFTNGP03 (DOT) phx.gbl...
Quote:
Set HtmlEncode = false for the column.

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net


"Vaughn Haybittle" <vhaybittle (AT) mweb (DOT) co.za> wrote in message
news:%23YDTNpxOHHA.4644 (AT) TK2MSFTNGP03 (DOT) phx.gbl...
Hi,

I have a Gridview which is populated via a stored procedure. One of the
coumns returned is a date. The date is currently displayed as 18/01/2007
00:00:00. I just want to show the date without the time i.e. 18/01/2007.
I have tried adding a dataformatstring of {0:d} but it is not making any
difference.

Can anyone advise me on what I am doing wrong?

T.I.A.

Vaughn






Reply With Quote
  #4  
Old   
Eliyahu Goldin
 
Posts: n/a

Default Re: Format Date in Databound column - 01-18-2007 , 05:26 PM



By default the column value is html encoded and, naturally, can be a string
only. Neither number nor date.

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin


"Vaughn Haybittle" <vhaybittle (AT) mweb (DOT) co.za> wrote

Quote:
Hi,

Thanks for the information. It worked perfectly. Can you please explain
briefly why changing this property made a difference.

Many thanks,

Vaughn


"Eliyahu Goldin" <REMOVEALLCAPITALSeEgGoldDinN (AT) mMvVpPsS (DOT) org> wrote in
message news:OQldwtxOHHA.4332 (AT) TK2MSFTNGP03 (DOT) phx.gbl...
Set HtmlEncode = false for the column.

--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net


"Vaughn Haybittle" <vhaybittle (AT) mweb (DOT) co.za> wrote in message
news:%23YDTNpxOHHA.4644 (AT) TK2MSFTNGP03 (DOT) phx.gbl...
Hi,

I have a Gridview which is populated via a stored procedure. One of
the
coumns returned is a date. The date is currently displayed as
18/01/2007
00:00:00. I just want to show the date without the time i.e.
18/01/2007.
I have tried adding a dataformatstring of {0:d} but it is not making
any
difference.

Can anyone advise me on what I am doing wrong?

T.I.A.

Vaughn








Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.