Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Datagrid Control > Format Date in Databound column

Reply
Thread Tools

Format Date in Databound column

 
 
Vaughn Haybittle
Guest
Posts: n/a
 
      01-18-2007
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
 
 
 
 
Eliyahu Goldin
Guest
Posts: n/a
 
      01-18-2007
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" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> 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
 
 
 
 
Vaughn Haybittle
Guest
Posts: n/a
 
      01-18-2007
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" <(E-Mail Removed)> wrote in
message news:(E-Mail Removed)...
> 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" <(E-Mail Removed)> wrote in message
> news:%(E-Mail Removed)...
>> 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
 
Eliyahu Goldin
Guest
Posts: n/a
 
      01-18-2007
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" <(E-Mail Removed)> wrote in message
news:%23X$(E-Mail Removed)...
> 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" <(E-Mail Removed)> wrote in
> message news:(E-Mail Removed)...
> > 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" <(E-Mail Removed)> wrote in message
> > news:%(E-Mail Removed)...
> >> 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

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
databound custom controls vs composite databound custom controls rodchar ASP .Net 0 11-26-2007 03:51 PM
templated databound control problem - not showing databound Manu ASP .Net Web Controls 0 05-22-2006 09:46 AM
Can't format a databound date cmay ASP .Net 2 03-07-2006 12:22 AM
Date, date date date.... Peter Grison Java 10 05-30-2004 01:20 PM
databound column to hyper link column susan ASP .Net Datagrid Control 1 01-12-2004 08:05 AM



Advertisments