The .NET Framwork 2.0 introduces Eval(). Eval() is a shortcut for Container.DataItem(). Since Eval() uses Reflection, it causes overhead. From a optimization standpoint, it is better to use Container.DataItem()
<%# Eval(''expression'') %>
<%# Eval(''expression'', ''format string'') %>
<%# Bind(''expression'') %>
<%# Bind(''expression'', ''format string'') %>
sameer.khanjit@gmail.com
View Blog Click "Mark as Answer" on the post that helped you.
athar_techsa...
Member
554 Points
316 Posts
How to convert to valid date time in c#?
Dec 16, 2012 12:30 PM|LINK
Hi
am getting data from database as
oned_gk
All-Star
31361 Points
6411 Posts
Re: How to convert to valid date time in c#?
Dec 16, 2012 01:04 PM|LINK
RameshRajend...
Star
7983 Points
2099 Posts
Re: How to convert to valid date time in c#?
Dec 16, 2012 01:07 PM|LINK
<asp:HyperLink ID="hypPublicationDate" runat="server" Text='<%# ((DateTime)Eval("DateField")).ToString("dd/MM/yyyy hh:mm:ss) %>'
athar_techsa...
Member
554 Points
316 Posts
Re: How to convert to valid date time in c#?
Dec 16, 2012 01:36 PM|LINK
yes am getting value from database as string. I have used the below code and its working fine.
string[] strArrCreateDate = null; StringBuilder creationDate = new StringBuilder(); if (DBVal.Contains("-")) { strArrCreateDate = DBVal.Split('-'); if (strArrCreateDate.Count() > 1) { creationDate.Append(DBVal.Split('-')[0].ToString()); creationDate.Append(" "); creationDate.Append(DBVal.Split('-')[1].Trim().Substring(0, 2).ToString() + ":" + DBVal.Split('-')[1].Trim().Substring(2, 2).ToString()); base.CRT_TIM = creationDate.ToString(); } } else base.CRT_TIM = DBVal;oned_gk
All-Star
31361 Points
6411 Posts
Re: How to convert to valid date time in c#?
Dec 16, 2012 02:00 PM|LINK
Dan Bracuk
Contributor
3970 Points
1096 Posts
Re: How to convert to valid date time in c#?
Dec 16, 2012 02:04 PM|LINK
That's the real problem. If you can do anything about that, do so.
sur200
Member
2 Points
1 Post
Re: How to convert to valid date time in c#?
Dec 17, 2012 05:09 AM|LINK
in which namespace I can find Eval in C#?
Thanks,
Surinder
sameer_khanj...
Contributor
7060 Points
1378 Posts
Re: How to convert to valid date time in c#?
Dec 17, 2012 09:51 AM|LINK
The .NET Framwork 2.0 introduces Eval(). Eval() is a shortcut for Container.DataItem().
Since Eval() uses Reflection, it causes overhead. From a optimization standpoint, it is better to use Container.DataItem()
<%# Eval(''expression'') %>
<%# Eval(''expression'', ''format string'') %>
<%# Bind(''expression'') %>
<%# Bind(''expression'', ''format string'') %>
sameer.khanjit@gmail.com
View Blog
Click "Mark as Answer" on the post that helped you.