Click here to Skip to main content
15,919,567 members
Please Sign up or sign in to vote.
1.33/5 (3 votes)
See more:
hi i have image tag in asp.net
VB
<asp:Image ID="ImgCapture" runat="server" Height="250px" Width="250px"
                                   AlternateText="Img" ImageAlign="Top" />


i want to assign image which is in my folder
ImgCapture.ImageUrl = "~/Web/images/img01.jpg";
but it is not showing me this image
thank you..
Posted
Comments
[no name] 10-Jul-12 5:42am    
is the image in USerside folder or any Other Panel like Admin ?

Be sure that, when you post any question one can easily understand it. We cannot see you screen, you should elaborate it with complete code snippets if you can.

For now refer Image Class[^] and its properties.
ASP.NET Image Control[^]

To load image in image control at run time please follow the link:
Dynamically loading image in Image control in ASP.NET[^]
 
Share this answer
 
v2
Comments
MAU787 10-Jul-12 5:46am    
thanx for replying
actually i have image control on my form(aspx)
and i have one image in my project which is in image folder
i want to assign that image to image control
i cant assign it directly becoz it is dynamic and created at run time
Manas Bhardwaj 10-Jul-12 6:29am    
+5!
Prasad_Kulkarni 10-Jul-12 6:34am    
Thank you Manas!
MAU787 10-Jul-12 6:46am    
i have explained my question in earlier post
is there any solution??
Prasad_Kulkarni 10-Jul-12 7:14am    
Please see my updated answer.
Please ensure that ~/Web/Images folder is added in your solution in Visual Studio, else even though the folder exists on your hard disk, if it is not added to Visual Studio images will not be displayed. Try this, if not resolved, please reply to my answer and I will make required updates.
 
Share this answer
 
Comments
MAU787 10-Jul-12 5:45am    
thanx for replying
this image is in my project folder only in image folder
Well it won't - you haven't told it where the file is. You need to specify the "ImageUrl" tag for the Image.
 
Share this answer
 
Comments
MAU787 10-Jul-12 5:47am    
thanx for replying
actually my image is not static i m creating it at runtime and want to assign it
at runtime only.
OriginalGriff 10-Jul-12 6:14am    
Then we need to see what code you are using to assign the URL to the image...
MAU787 10-Jul-12 6:18am    
ImgCapture.ImageUrl = "~/Web/images/img01.jpg";
this is a code it work on page load only
Where have u actually written this code ? Means which function or events ?
u can post the whole codes...
MAU787 10-Jul-12 8:12am    
i have written in function which is called when fingerprint gets captured.
VB
<asp:Image ID="ImgCapture" runat="server" Height="250px" Width="250px"
                                   AlternateText="Img" ImageAlign="Top" />



// write on code behind

 protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            ImgCapture.ImageUrl = "~/img/tech-brief.jpg"; 
        }

    }
 
Share this answer
 
Comments
MAU787 10-Jul-12 8:11am    
Thanx for ur reply
acually i want it in function and not on page load

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900