Hi,
It's a bit of a workaround, but you could have a hidden field in your ItemTemplate tag:
<asp:HiddenField ID="HiddenField1" runat="server" Value='<%# Eval("web") %>' />
You could then set the 'runat' attribute of the div to 'server' and give the div an ID.
<div id="divWeb" runat="server" visible="false">Web: <a href="<%# Eval("Web") %>"><%# Eval("Web") %></a></div>
In your code-behind, you check whether or not HiddenField1
is empty. If it's not empty, then set 'divWeb' visible = true
.
The downside to this method is that the user could manually change the HiddenField1 value. However, if that's not a problem (security wise), then you could try this method.
Update
The code snippet below is from the inline section of this site:
<asp:Repeater id="collectionRepeater" Runat="server">
<ItemTemplate>
<%# DataBinder.Eval(Container.DataItem, "OwnerId") %> -
<asp:literal ID="see" Runat="server"
Visible='<%# (int)DataBinder.Eval(Container.DataItem, "Pets.Count") > 0 %>'>
see pets
</asp:Literal>
<asp:literal ID="nopets" Runat="server"
Visible='<%# (int)DataBinder.Eval(Container.DataItem, "Pets.Count") == 0 %>'>
no pets
</asp:Literal>
<br />
</ItemTemplate>
</asp:Repeater>
There are also alternative options in this thread