Solved

Display only date in a ASP.NET template field

Posted on 2009-06-30
2
430 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…

911 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

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now