Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Display only date in a ASP.NET template field

Posted on 2009-06-30
2
Medium Priority
?
448 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:
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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…
Suggested Courses

773 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