Format Date in Databound column

V

Vaughn Haybittle

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
 
V

Vaughn Haybittle

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 said:
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 said:
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
 
E

Eliyahu Goldin

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 said:
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 said:
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 said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,022
Latest member
MaybelleMa

Latest Threads

Top