Re: Date format in repeater control

Tech-Archive recommends: Fix windows errors by optimizing your registry



Right, that is what I was doing, only I wasn't using the Eval... in
other words, I was trying to do:

IIF(IsDBNull(datavalue),"",Format(datavalue,"MM/dd/yyyy"))

which was failing because the IIF does not behave like
If..AndAlso...End If nor like If...OrElse...End If, and I was treating
it as though it did; so the "false" condition of the IIF was getting
examined, and blowing up for DBNull values.

I changed it to

IIF(IsDBNull(Container.DataItem("DateField")),"",DataBinder.Eval(Container.DataItem,"DateField","{0:MM/dd/yyyy}"))

which works just fine since the DBNull evaluates to an empty string, as
you said.

Thanks!
zdrakec

.



Relevant Pages

  • Re: Getting error with IsDBNull and not sure why
    ... > and I get the error message ... > Object cannot be cast from DBNull to other types. ... As part of preparing the argument list for the call to IIf, ...
    (microsoft.public.dotnet.general)
  • Re: Counting blanks fields for a report
    ... > Thanks for your patience. ... > Robin Chapple ... >>You may need to use IIf() to prevent division by 0. ... Prev by Date: ...
    (microsoft.public.access.reports)
  • Re: #Num!
    ... > so we'll use the iif for the second value and the nz for the first value. ... >> results in #Num! ... >> Claudette Hennessy ... Prev by Date: ...
    (microsoft.public.access.forms)
  • Re: joining multiple fields in a query
    ... I can't visualize it! ... You might need to use parentheses: ... or IIF: ... Prev by Date: ...
    (microsoft.public.access.queries)
  • Re: a cast issue
    ... Herfried & Cor, ... Ergo I like my Generic IIf... ... | M S Herfried K. Wagner ... Prev by Date: ...
    (microsoft.public.dotnet.languages.vb)