Groups | Blog | Home
all groups > asp.net > may 2004 >

asp.net : Expression Expected Error


Wayne Wengert
5/22/2004 8:01:31 PM
I am trying to build an aspx page with a repeater contol bound to a
sqldatareader. I can get the basic fields to display just fine but I want to
format a date/time filed. My code is below. I am getting "Expression
Expected" on the line where I am trying to build a formatted date string.

What did I miss here?

Wayne


======================================
<asp:Repeater id="Repeater1" runat="server">
<ItemTemplate>
<tr>
<%
Dim strTemp As String
strTemp = #Container.DataItem("StartDate").ToString( "d" ) <==
Error occurs here
Response.Write("<td>" & strTemp & "</td>")
%>
<td><%# Container.DataItem("RegionalID") %> </td>
<td><%# Container.DataItem("Location") %> </td>
<td align="center"> <%# Container.DataItem("NbrOfDays") %> </td>
</tr>

</ItemTemplate>
</asp:Repeater>

Torrent Nicolas
5/23/2004 11:04:09 PM
Try to use <%# DataBinder.Eval(Container.DataItem,"StartDate","{0:d}")%>

"Wayne Wengert" <wayneDONTWANTSPAM@wengert.com> a écrit dans le message de
news:O5mhnnGQEHA.3708@TK2MSFTNGP10.phx.gbl...
[quoted text, click to view]

AddThis Social Bookmark Button