• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1712
  • Last Modified:

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

0
shieldguy
Asked:
shieldguy
1 Solution
 
Pratima PharandeCommented:
<%#Convert.ToString(DataBinder.Eval(Container.DataItem, "OrderDate")).Tostring("dd/MM/yyyy")
%>
0

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now