I'm looking to display a checkbox field within a gridview.
Currently, I am using the
Checked='<%# Convert.ToBoolean(Eval("Inactive")) %>'
statement. However, I've encountered an issue where some records in the database have a NULL
value for the Inactive
field. When the value is 0 or 1, it works as expected, but when it's NULL
, it throws an exception.
Can someone please advise me on how to populate the checkbox so that it remains unchecked if the field is null
? Thank you in advance!