Eval - DBNull - ObjectDataSource

  • Thread starter Thread starter Alexander Widera
  • Start date Start date
A

Alexander Widera

Hello,

i'm using an asp:Reader and an ObjectDataSource. With this I get some
strings and integer-values... but some of the intergervalues could be a
<DBNull>-value.

In the repeater is a link, which should only be visible, if the an
integer-value isn't null (dbnull) (the value should be a number!).
I've tried much, but nothing worked. I get always an error-message with an
exception, that says, that the intergervalue is DBNull.

here is the code of the last try:

<asp:HyperLink ID="HyperLink2" runat="server" Visible='<%#
Eval("someID")!=DBNull.Value %>' NavigateUrl="#">My Link</asp:HyperLink>

I tried also:
((int?)Eval("someID")).HasValue

no success until now.


Could someone help me please?
thanks a lot,

Alex
 
Have you tried
<asp:HyperLink ID="HyperLink2" runat="server" Visible='<%#
!Convert.IsDBNull(Eval("someID")) %>' NavigateUrl="#">My
Link</asp:HyperLink>?
 
doesn't work :(

the message again: The value for the row SomeID in table mytable is DBNull.
 
Can you please provide some more info (exception info and/or code)?
It's really difficult to understand what's going on from a single line of
code.

____________________
Konstantinos Pantos
MCP Software Engineer
http://kostas.pantos.name
 
Back
Top