Solved

Display only date in a ASP.NET template field

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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

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…
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…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

708 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

16 Experts available now in Live!

Get 1:1 Help Now