asp.net - How do I show column type Date/Time in VB GridView -


i using database in access 2010. , using visual studio 2005. have data in column of type "date/time" this:

enter image description here

and show in gridview

<asp:templatefield headertext="date" sortexpression="date_request"> <itemtemplate>     <asp:label id="label_date" runat="server" text='<%# bind("date_request") %>'/> </itemtemplate> </asp:templatefield> <asp:templatefield headertext="time" sortexpression="time_request"> <itemtemplate>     <asp:label id="label_time" runat="server" text='<%# bind("time_request") %>'/> </itemtemplate> </asp:templatefield> 

then displays this: enter image description here

i don't know why not showing same database. show me how make trhem display same?

replace of above code following code.

<asp:boundfield datafield="date_request" dataformatstring="{0:d}" headertext="date" /> <asp:boundfield datafield="time_request" dataformatstring="{0:t}" headertext="time" /> 

or use below code

text='<%# bind("date_request", "{0:d}") %>' text='<%# bind("time_request", "{0:t}") %>' 

Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -