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:
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:
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
Post a Comment