duppypog
asked on
using a function getting BC30451 error
I'm still coding in VS 2003, ASP.NET 1.1 because I work in the public sector and we have no money for training. I have one line of code, that calls one function that already works perfectly in other applications, but I cannot find one difference to figure out why it's not working here. The code uses a function to return an image.
The .apsx page reads:
<asp:Image Runat="server" Width="100" AlternateText="Photo Unavailable" ImageUrl='<%# GetImg(Container.DataItem( "ImageID") ) %>' ID="Image1" ></asp:Image>
The Function looks like this:
Public Function GetImg(ByVal sImg As Object) As String
Try
With sImg
If sImg Is DBNull.Value Then
sImg = "Imgs\nophoto.gif"
Else
sImg = "http://www.hcso.org/Records/Images/" & sImg & ".jpg"
'Response.ContentType = "image/jpeg"
'Response.BinaryWrite(sImg )
'Response.End()
End If
End With
Return sImg
lblError.Text = sImg
Catch ex As Exception
lblError.Text = ex.ToString
End Try
End Function
Does anyone see any reason why this would not work like in the other apps???
Thank you!
The .apsx page reads:
<asp:Image Runat="server" Width="100" AlternateText="Photo Unavailable" ImageUrl='<%# GetImg(Container.DataItem(
The Function looks like this:
Public Function GetImg(ByVal sImg As Object) As String
Try
With sImg
If sImg Is DBNull.Value Then
sImg = "Imgs\nophoto.gif"
Else
sImg = "http://www.hcso.org/Records/Images/" & sImg & ".jpg"
'Response.ContentType = "image/jpeg"
'Response.BinaryWrite(sImg
'Response.End()
End If
End With
Return sImg
lblError.Text = sImg
Catch ex As Exception
lblError.Text = ex.ToString
End Try
End Function
Does anyone see any reason why this would not work like in the other apps???
Thank you!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I don't see why you;re using With sImg. It serves no purpose there.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
No, after your Try.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Will have to revisit this after I complete the NEW project I was given. I love switching gears mid-stream!