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
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