Conditional logic in DataList?
Posted on 2004-10-21
I've created the following function to add an 'out of stock' message to a DataList:
Protected Function CheckInStock(InStock As Object) As String
If InStock = False Then
Return "<span class='Text'>Out Of Stock</span>"
However, if InStock is false, I also need to disable the HyperLink and ImageButton controls below:
<asp:HyperLink NavigateUrl='<%# "AddToCart.aspx?productID=" & (Container.DataItem( "ID" ))%>' Runat="server"><asp:ImageButton ID="AddtoCart" ImageUrl="Images/addtocart.gif" runat=server /></asp:HyperLink>
I'm sure this is fairly simple but I'm really struggling. Any help would be much appreciated.