We help IT Professionals succeed at work.

How to set the date format in repeater control

I am converting the classic asp code to the asp.net code now i am having problem in one place where in asp classsic code the date is read one by one and then its formated accordingly but as i am using the repeater in asp.net i dont know how to impletent such change in asp.net

Thanks
WEBFORM.ASPX CODE:
 
	    <asp:Repeater ID="searchList" runat="server">
		    <ItemTemplate>
			    <tr>
				    <td>
					    <a href="new_internet_order_display.asp?OrderID=<%#DataBinder.Eval(Container.DataItem, "OrderID")%>">
					    <FONT FACE="Arial" SIZE="2">
					    <B>
					    <%#DataBinder.Eval(Container.DataItem, "CardHolderLastName")%>
					    &nbsp;
					    <%#DataBinder.Eval(Container.DataItem, "CardHolderTitle")%>
					    &nbsp;
					    <%#DataBinder.Eval(Container.DataItem, "CardHolderInitials")%>
					    </B>
					    </a>
					    </td><td><font size=2>
					    <%#DataBinder.Eval(Container.DataItem, "CardPostCode")%>
					    </tD><td><font size=2><b>
					    <%#DataBinder.Eval(Container.DataItem, "CardCountryName")%>
					    </b></FONT>
					    </td><td>
                        <FONT FACE="Arial" SIZE="2"><B><%#DataBinder.Eval(Container.DataItem, "OrderDate", "{0:dd/mm/YYYY}")%></B></FONT>
					    
				    </td>
			    </tr>
		    </ItemTemplate>
	    </asp:Repeater>
 
 
REFERENCE CLASSIC ASP CODE:
'make sensible Date
	Dim Today
	Today = rs("OrderDate")
	
	Dim Day
	Day = DatePart("d", Today)
	
	Dim Month
	Month = DatePart("m", Today)
	
	Dim Year
	Year = DatePart("yyyy", Today)
	
	Dim UseDate
	UseDate = Day & "/" & Month & "/" & Year
	Response.Write "<B>" & UseDate & "</B>"

Open in new window

Comment
Watch Question

CERTIFIED EXPERT
Commented:
<%#Convert.ToString(DataBinder.Eval(Container.DataItem, "OrderDate")).Tostring("dd/MM/yyyy")
%>