The problem is that you're using this syntax <% %> which doesn't work as
databinding, so you don't have access to Container.DataItem (the item
bounded). This syntax <%# .... %> is used for databinding purpose
So what you would have to do is
<asp:DataList ...>
<ItemTemplate>
<%# DataBinder.Eval(Container.DataItem, "bBooleanField") %><br/>
<%# Convert.ToBoolean(DataBinder.Eval(Container.DataItem,
"bBooleanField")).ToString() %>
</ItemTemplate>
</asp:DataList>
Note this:
DataBinder.Eval(Container.DataItem, "bBooleanField")
this return an Object type, so you would have to use Convert.ToBoolean
to get a Boolean
type and then use the ToString() method of the Boolean
type to get True or False