?
Solved

Conversion from type 'DBNull' to type 'Boolean' is not valid.

Posted on 2007-10-18
1
Medium Priority
?
839 Views
Last Modified: 2012-08-14
how do u handle it in this case
Dim cholo As Boolean = CType(DataBinder.Eval(e.Row.DataItem, "morning"), Boolean)


_________this is the code if needed____________
   If e.Row.RowType = DataControlRowType.DataRow Then
            Dim lnkFile As HyperLink = CType(e.Row.FindControl("lnkFile"), HyperLink)
            Dim image1 As Image = CType(e.Row.FindControl("image1"), Image)
            Dim cholo As Boolean = CType(DataBinder.Eval(e.Row.DataItem, "morning"), Boolean)
            If cholo = True Then
                image1.visible = True
            Else
                lnkFile.Visible = True
               
            End If
        End If
0
Comment
Question by:gianitoo
1 Comment
 
LVL 9

Accepted Solution

by:
Raju Srivatsavaye earned 2000 total points
ID: 20102607
 If e.Row.RowType = DataControlRowType.DataRow Then
            Dim lnkFile As HyperLink = CType(e.Row.FindControl("lnkFile"), HyperLink)
            Dim image1 As Image = CType(e.Row.FindControl("image1"), Image)
            Dim cholo As Boolean = False
           if not IsDBNULL(DataBinder.Eval(e.Row.DataItem, "morning") ) then
                     cholo = CType(DataBinder.Eval(e.Row.DataItem, "morning"), Boolean)
             end if
            If cholo = True Then
                image1.visible = True
            Else
                lnkFile.Visible = True
               
            End If
        End If
0

Featured Post

Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses the ASP.NET AJAX ModalPopupExtender control. In this article we will show how to use the ModalPopupExtender control, how to display/show/call the ASP.NET AJAX ModalPopupExtender control from javascript, how to show/display/cal…
User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
Suggested Courses
Course of the Month17 days, 2 hours left to enroll

862 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question