Re: Eval - DBNull - ObjectDataSource

Tech-Archive recommends: Speed Up your PC by fixing your registry



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


"Alexander Widera" <awid@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message news:O7m0dnLDHHA.4992@xxxxxxxxxxxxxxxxxxxxxxx
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


.



Relevant Pages

  • Re: Eval - DBNull - ObjectDataSource
    ... strings and integer-values... ... integer-value isn't null (dbnull). ...
    (microsoft.public.dotnet.framework.aspnet)
  • Eval - DBNull - ObjectDataSource
    ... strings and integer-values... ... In the repeater is a link, which should only be visible, if the an ... integer-value isn't null (dbnull). ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Eval - DBNull - ObjectDataSource
    ... Can you please provide some more info (exception info and/or code)? ... With this I get some strings and integer-values... ... but some of the intergervalues could be a -value. ... In the repeater is a link, which should only be visible, if the an integer-value isn't null (dbnull). ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Eval - DBNull - ObjectDataSource
    ... The value for the row SomeID in table mytable is DBNull. ... i'm using an asp:Reader and an ObjectDataSource. ... strings and integer-values... ...
    (microsoft.public.dotnet.framework.aspnet)