Here's what I've done so far:
The following markup for an asp:image is in an aspx file in my root folder:
<asp:Image runat="server" ID="imgGradLarg e" ImageUrl='<%#
imageFileToDisp lay("~/Images/ClassmatePics/", val("GradPhotoF ileName"))
%>'></asp:Image>
This VB.net code is in my App_Code folder in a file caled MyUtils.vb
Public Shared Function imageFileToDisp lay(ByVal imageFilePath As String,
ByVal imageFileName As String) As String
If System.IO.File. Exists(imageFil ePath & "/" & imageFileName) Then
imageFileToDisp lay = imageFilePath & "/" & imageFileName
Else
imageFileToDisp lay = imageFilePath & "/NoClassmatePic. jpg"
End If
End Function
I'm sure there's more wrong that I am not aware of but for starters I get
this error:
Compiler Error Message: BC30451: Name 'imageFileToDis play' is not declared.
If you are tempted to respond with "You need to declare
'imageFileToDis play'" then please don't respond. I need to know HOW to do
that in the aspx markup. I haven't found anything that explains how to do
that.
If you see anything else I need to correct, please feel free to be as
specific as possible.
I really need specific coding help. I'm a bit lost on this right now. Pseudo
code suggestions are not what I'm looking for. I need someone to either show
me (I'm still learning) how to corrrect the above code or at least point me
to a website that expains (with actual example code) how to do what I'm
trying to do.
Keith
"Keith G Hicks" <kr*@comcast.ne twrote in message
news:eZ******** ******@TK2MSFTN GP05.phx.gbl...
I'm hoping there's a simple way to do this. I need to show a dummy image
in
an asp image object if the file is missing. Here's my asp.net 2.0 markup:
<asp:Image ID="imgGrad" runat="server" BorderColor="Di mGray"
BorderStyle="So lid" BorderWidth="1p x" Height="120px" ImageUrl='<%#
"~/Images/ClassmatePics/" & Eval("GradPhoto FileName") %>' ToolTip="Click
to
enlarge" /></td>
"GradPhotoFileN ame" is stored in a field in a table. If the file name
stored
in the table is "JeffJones. jpg" but there is no "JeffJones. jpg" file in
the
"~/Images/ClassmatePics/" folder then I have a dummy jpg image that I want
to show ("MissingPhoto. jpg").
I'm hoping there's an easy way to do that maybe in the EVAL code but I
don't
know how. Can someone help me out?
Thanks,
Keith