Click here to Skip to main content
15,891,184 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I would like to do different button when there is null(no image) in the database. But, it shows two buttons instead of one button only. Can you guys help me? I tried at the frontend only. If there are solutions to do at the backend, please share some codes.

What I have tried:

This is the codes that I've tried at the frontend.

<a href="#" id="ImageButton2" class="btn btn-success" visible='<%# If(IsDBNull(Eval("ImagePic")), True, False)%>'>No Image</a>
                                                   <a href="#" id="ImageButton" class="btn btn-success" visible='<%# If(IsDBNull(Eval("ImagePic")), False, True)%>' onclick="popitup('Fetch_Image.aspx?id=' + <%# Eval("id")%>); return false;">Actual Image</a> </td>
Posted
Updated 29-Sep-20 22:01pm

1 solution

You haven't added runat="server" to your <a> element. As a result, the visible=... simply sets an attribute in the HTML output, rather than hiding the control.
ASP
<a runat="server" href="#" id="ImageButton" class="btn btn-success" visible='<%# If(...
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900