Repeater class

  • Thread starter Thread starter Calvin Lai
  • Start date Start date
C

Calvin Lai

Hi all,

I have a repeater control trying to display some info including date
information to the client. I used the following:
<%# DataBinder.Eval(Container.DataItem, "Date", "DataTime.Parse({0},
oCulture)") %>
but it doesn't work as intended. (The oCulture is a culture info object).I
also tried:
<%# DateTime.Parse(DataBinder.Eval(Container.DataItem, "Date", "{0}"),
oCulture) %>;
However, it also gives me runtime compilation error.

Anyone has idea how to do this? I believe this shd be simple. Thanks for
all contributions.

Calvin
 
Hi,

You have to use string similar to those used by String.Format :
d - shourt date format.
D - long date format.
<%# DataBinder.Eval(Container.DataItem, "Date", "{0:d}") %>


Natty Gur[MVP]

blog : http://weblogs.asp.net/ngur
Mobile: +972-(0)58-888377
 
Hi,

Thanks for the solution. However, what if I want to display it accroding to
a specific culture? For the DateTime display, I could display it as
DataTime.Parse(dateString,oCulture)
In this case, how would I be able to do that? Thanks.
 
Back
Top