Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Display only date in a ASP.NET template field

Posted on 2009-06-30
2
Medium Priority
?
443 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 9

Accepted Solution

by:
Seven price earned 2000 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

In an ASP.NET application, I faced some technical problems. In this article, I list them out and show the solutions that I found.  I hope it will be useful. Problem: After closing a pop-up window, the parent page should be refreshed automaticall…
In .NET 2.0, Microsoft introduced the Web Site.  This was the default way to create a web Project in Visual Studio 2005.  In Visual Studio 2008, the Web Application has been restored as the default web Project in Visual Studio/.NET 3.x The Web Si…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…

722 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