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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

can't display image using <img src="<%=file%>" />

Status
Not open for further replies.

znet

Programmer
Aug 23, 2004
41
CA
Hi all,
I am newbie of .NET, I want to display images. The code like this:
<script language="VB" runat="server">
Sub page_load()
Dim fileid as String
fileid="../imgs/myimage.jpg"
end
</script>
<html><body>
<img src="<%=fileid%>" />
</body></html>


It works in ASP, but not in ASP.Net. Why? Thanks in advance.
 
That's the old way of thinking (asp). Now you have a rich set of server controls to use.

Look into the image control. It can dynamically load images. Like this:

Sub Page_Load
imgImage1.ImageURL = ("../imgs/myimage.jpg")
End Sub

<body>
<asp:Image id="imgImage1" Runat="Server"></asp:Image>
</body>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top