Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

setting the image url of an image map

Status
Not open for further replies.

autumnEND

Programmer
Nov 1, 2005
61
GB
Im trying to set the image url of an image map , the image map is stored within a datalist.
It basically displays an avatar for the user who has posted the forum post.

however if the user doesnt have an image uploaded on the database, when they write some news for there image, it displays the red cross image error.

<asp:ImageMap ID="avatarmap1" runat="server" ImageUrl='<%# "avatarimagefetch.ashx?memberid=" &Cstr(Convert.ToString( Eval("memberid"))) %>'>

i tried the following in the page load , but it didnt work

Dim i As Integer
For i = 0 To DataList1.Items.Count - 1
Dim avatarLabel As Label = CType(DataList1.Items(i).FindControl("avatarLabel"), Label)
Dim avatarmap1 As ImageMap = CType(DataList1.Items(i).FindControl("avatarmap1"), ImageMap)
If avatarLabel.Text = "" Then
avatarmap1.ImageUrl = "images/nophoto.gif"
Else
avatarmap1.ImageUrl = "avatarimagefetch.ashx?memberid=" & CStr(Convert.ToString(Eval("memberid")))

End If
Next

avatarlabel, basically displays the image type , such as System.Byte[]. or displays null if the user doesnt have an image uploaded

does anyone have any ideas where im going wrong?

thanks in advance
 
Why are you using an ImageMap control to display an avatar? Why not an ImageButton or even a <a><img></a>? An ImageMap control renders itself as a <map> tag. You can define regions by adding HotSpot objects to the HotSpots collection. Seems like the wrong control for the job (to me anyway - or else I just don't get what you're trying to do).
 
Thanks , ill change it to an image, i dont even know why i was using an image map.

basically all i want to do is display a default image, such as one saying no photo uploaded" if the user doesnt have an avatar as appose to showing the red cross (image unavailable thing)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top