how to hide red cross when no image available?

  • Thread starter Thread starter Ben
  • Start date Start date
B

Ben

Hi,

i defined an imagebutton like this:
<asp:ImageButton ID="ImageButton1" runat="server" />

Sometimes, the picture must be shown, sometimes not.
I did this in code-behind:
Dim x As Integer

x = 4

If x = 5 Then

ImageButton1.ImageUrl = "~/fotos/hei80.jpg"

End If

So now, i get a red cross instead of the picture. What i want is to get rid
of that red cross and to see nothing.

Thanks
Ben
 
I found it like this:
Dim x As Integer
Dim img As ImageButton
img = New ImageButton
img.ImageUrl = "~/fotos/hei80.jpg"
x = 5
If x = 5 Then
form1.Controls.Add(img)
End If
 
Back
Top