IIF is for VB.NET.
Try to use Eval("EffDate").ToString("d") or String.Format("{0:d}", Eval
("EffDate")). You can replace "d" with "yyyy-MM-dd HH:mm:ss" or up to
you.
Eval only take one parameter, maybe there is no overload. Im not
remember. Thats why it show overload error.
IIF:
Look like you want to display the latest date. I think your issue is
not related to this but keep in mind that IIF is not recommended.
because it is not same like ?: do in C#. VB.NET will evaluate both
true and false statement first before evaluate it. So statement IIF
(Person Is Nothing, "(No user)", Person.Name) will throw an error if
Person is Nothing (null) even the "(No user)" is selected.
Keep use simple code inside <%...%>. If complex, put in code behind,
assign the result in a variable and show the variable in <%...%>.
On Apr 21, 1:37 am, Mac222 <[email protected]>
wrote:
> I am fairly new to ASP.NET, but have been using classic ASP for quick
> awhile. I am in the process of building a new website for our company
> using ASP.NET. I am using data extracted from a Microsoft Access
> database and have been successful in retrieving the data in question.
> However, I ran across one small problem. My current code reads:
>
> <%#IIf(Eval("EffDate") <= Container.DataItem("NewEffDate"), _
> Container.DataItem("NewEffDate"), Container.DataItem
> ("EffDate"))%>
>
> The only problem is the 'NewEffDate' and 'EffDate' are both displaying
> the date and time (9/22/2008 12:00:00 AM). The entry in the database
> (ShortDate format) only shows the date.
>
> My problem: How do I suppress the time? I've tried string.format
> ("NewEffDate", {0:d}"), but I get an 'Overload resolution" failed
> message.
>
> Thanks in advance for any assistance I can get.