Link to home
Start Free TrialLog in
Avatar of Member_2_1242703
Member_2_1242703

asked on

Checking a checkbox based on SQL DataReader boolean value in ASP.NET(VB)

I'm using the following to populate text fields from a data reader:

                If Not CType(Session.Item("reader"), Data.SqlClient.SqlDataReader)("MyField") Is DBNull.Value Then
                    tbMyTB.Text = CType(Session.Item("reader"), Data.SqlClient.SqlDataReader)("MyField").ToString
                Else
                    tbMyTB.Text = ""
                End If

Open in new window


I have some checkboxes that I would like to do the same thing from boolean values. How would I check the box for true, keep unchecked if false?
Avatar of David Johnson, CD
David Johnson, CD
Flag of Canada image

checkbox1.checked = tablevalue.truefalse
ASKER CERTIFIED SOLUTION
Avatar of Ryan Chong
Ryan Chong
Flag of Singapore image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial