1 Attachment(s)
Display Only Date in GRDVIEW
Im My Gridview ,date is coming along with time.My date is in format dd/mm/yyy -
To display only the date in Grdview,I used
Code:
<asp:BoundField DataField="EFFECTIVE_DATE" DataFormatString="{0:dd/MM/yyyy}"
HeaderText="Effective Date" />
But this code is reversing my month & date .See in Pic.
I want to display only the date??How to do dat??
Re: Display Only Date in GRDVIEW
Hey,
Have you looked here:
http://msdn.microsoft.com/en-us/libr...matstring.aspx
There are various DataFormatString's that you can use.
Gary
Re: Display Only Date in GRDVIEW
Handle RowDataBound Event
or
1> Select Gridview's Smart Tag
2> Edit Columns
3> select Column..after choosing column you can see the properties
4> Fill DataTextProperty = { 0 : d }
hope that would be the end of it
hope that helps
Re: Display Only Date in GRDVIEW
Quote:
Originally Posted by
dnanetwork
Handle RowDataBound Event
For a simple manipulation of the string of the DateTime object, I don't see why this would be required. If there were additional processing required, then I would agree, but in this case, no.
Re: Display Only Date in GRDVIEW
Turn off HtmlEncode
Code:
<asp:BoundField DataField="EFFECTIVE_DATE" DataFormatString="{0:dd/MM/yyyy}"
HeaderText="Effective Date" HtmlEncode="false" />
Or,
Try this one if this works for you:
http://hspinfo.wordpress.com/2008/01...nfig-settings/
Re: Display Only Date in GRDVIEW
Yes, nepalbinod is correct.
I dont know, what exactly it means, but "HtmlEncode" will do the trick..
Just set it to false and see the magic.
Experts, Can you give, what exactly it meant and how it will goes ??
Regards,
Naga..
Re: Display Only Date in GRDVIEW
Hey,
I really don't understand why setting this property to false:
http://msdn.microsoft.com/en-us/libr...tmlencode.aspx
Would change the output that the OP said they were getting.
sonia, can you show the rendered contents of that cell in both cases?
Gary