how to hide red cross when no image available?

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
 
B

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,982
Messages
2,570,185
Members
46,736
Latest member
AdolphBig6

Latest Threads

Top