Hi Nathan,
I suspect you need to cast it as a boolean and then reverse the logic like
this:
Visible='<%# !(bool)DataBinder.Eval(Container.DataItem,"Discontinued")%>'
Full code below.
Ken
MVP [ASP.NET]
Author: ASP.NET 3.5 For Dummies
<%@ Page Language="C#" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Repeater ID="Repeater1" runat="server"
DataSourceID="SqlDataSource1">
<ItemTemplate>
<asp:Label ID="lblProductName" runat="server" Text='<%#
DataBinder.Eval(Container.DataItem,"ProductName") %>'
Visible='<%#
!(bool)DataBinder.Eval(Container.DataItem,"Discontinued")%>'>
</asp:Label><br />
</ItemTemplate>
</asp:Repeater>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:NORTHWNDConnectionString1 %>"
ProviderName="<%$
ConnectionStrings:NORTHWNDConnectionString1.ProviderName %>"
SelectCommand="SELECT [ProductName], [Discontinued] FROM
[Products]"></asp:SqlDataSource>
</div>
</form>
</body>
</html>
"Nathan Sokalski" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>I have several controls in an ItemTemplate in a Repeater that will
>sometimes be hidden. I would like to do this by setting the Visible
>property using something like:
> Visible='<%# DataBinder.Eval(Container.DataItem,"deleted") %>'
>
>
>
> However, this is giving me a conversion error. I have tried having the
> database return several different values (the db field is of type bit, but
> I need to use a case statement because Visible is set to the opposite of
> the db field), but still recieve the same error. I know that I can use the
> ItemDataBound event, but would prefer not to since I am simply setting a
> property, not doing any calculations. The database I am using is SQL
> Server 2005, and I am using ASP.NET 2.0. Thanks.
>
> Nathan Sokalski
> (E-Mail Removed)
> http://www.nathansokalski.com/
>