Solved

Display only date in a ASP.NET template field

Posted on 2009-06-30
2
431 Views
Last Modified: 2012-05-07
Hello,
I have one ASP.NET web form using a Detail View, DV1 which is bound to an object data source, ODS.

i have a template field in DV1, and it's bound to a field in the ODS as :

                 <ItemTemplate>
                    <asp:Label ID="LB1" runat="server" Text='<%# Bind("tDate") %>'> </asp:Label>
                 </ItemTemplate>
When loaded the DV1 displays the date and the time in the field, how can i only display the date?
thanks
0
Comment
Question by:Nyana22
2 Comments
 
LVL 9

Accepted Solution

by:
sevensnake77 earned 500 total points
ID: 24749300
Is the data in the table.?  If so how are you selecting the date?

and you could select the date like.

<ItemTemplate>
         <asp:Label ID="LB12" runat="server" visible="false" Text='<%# Bind("id") %>'> </asp:Label>
                    <asp:Label ID="LB1" runat="server" Text='<%# Bind("tDate") %>'> </asp:Label>
                 </ItemTemplate>


        <%#DataBinder.Eval(Container.DataItem, "tDate", "{0:MM-dd}")%>


and then choose a format.

0
 

Author Comment

by:Nyana22
ID: 24749614
in the database table the filed in datetime in MySQL.

but in the query i am using select date(field)....
in the database it's only showing the date from the datetime,
but the weird stuff is in the web form it's showing everything, even  if i am using the function date...
0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question