HighTechTalks DotNet Forums  

Un-wanted format

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


Discuss Un-wanted format in the ASP.net Data Grid Control forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
J. Active
 
Posts: n/a

Default Un-wanted format - 03-31-2007 , 06:56 AM






Hi All;

I am developing a small ASP.NET web site using VS2003, I have a problem when
displaying date information. There is a table made in access 2003 call
“courses”, and I want a data grid component on one of the pages to be
populated with this table. Every thing going very fine except that the column
“Starting Date” in the data grid shows date with a time (for example 1/3/2007
08:00:00 AM) the bothering part is “12:00:00 AM” how could I remove it and
ban it from appearing only as (1/3/2007) with no time. Despite that there is
no appearance of (08:00:00 AM) in the data base column. I don’t know why
ASP.NET attach it to the original date !!

Please help !



--


****************
Nothing at all in this life is perfect. Just live your life a day by day !
****************

Reply With Quote
  #2  
Old   
Teemu Keiski
 
Posts: n/a

Default Re: Un-wanted format - 04-15-2007 , 03:32 AM






Hi,

you need to user string formatting For example if you have a BoundColumn,
set for example DataFormatString="{0:MM/dd/yyyy}" into it. If you use
DataBinder.Eval, give format string as third parameter

<%#DataBinder.Eval(Container.DataItem,"Starting Date","{0:MM/dd/yyyy}") %>


--
Teemu Keiski
AspInsider, ASP.NET MVP
http://blogs.aspadvice.com/joteke
http://teemukeiski.net





"J. Active" <JActive (AT) discussions (DOT) microsoft.com> wrote

Quote:
Hi All;

I am developing a small ASP.NET web site using VS2003, I have a problem
when
displaying date information. There is a table made in access 2003 call
“courses”, and I want a data grid component on one of the pages to be
populated with this table. Every thing going very fine except that the
column
“Starting Date” in the data grid shows date with a time (for example
1/3/2007
08:00:00 AM) the bothering part is “12:00:00 AM” how could I remove it and
ban it from appearing only as (1/3/2007) with no time. Despite that there
is
no appearance of (08:00:00 AM) in the data base column. I don’t know why
ASP.NET attach it to the original date !!

Please help !



--


****************
Nothing at all in this life is perfect. Just live your life a day by day !
****************


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.