In ASP.NET, using VB, how can i do this on the page itself, not in the code behind?
<ItemTemplate>
<% If Container.DataItem("filename") <> "" Then
<a href="/pdf/"><%# Container.DataItem("filename") %>Agenda</a>
End If%>
</ItemTemplate>
Create a boolean property in your data source e.g. filenameExists and use this to databind against the Visible property of a HyperLink
<asp:HyperLink runat="server" Visible='<%# Eval("filenameExists ") %>' NavigateUrl="/pdf/">Agenda</asp:HyperLink>
Ended up using this, thanks for your help guys!
On the page:
<asp:Literal ID="ltPDF" runat="server" Visible='<%# showPDF(Container.DataItem("filename")) %>'>Test</asp:Literal>
Code behind:
Function showPDF(ByVal pdf As String) As Boolean
If pdf <> "" Then
Return True
Else
Return False
End If
End Function
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With