Click here to Skip to main content
15,895,256 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello everyone,

I am making a website in asp.net which has a master page at root level , and a child page in a folder.
E.g Helpdesk root level - MasterPage1.master
Helpdesk/School (folder)/SchoolEntry.aspx Page
Helpdesk/Images(folder)/header_image.jpeg

Now the master page has image on its header from Images folder, now when i select master page for the webform(child) its image is not shown.

Image for master page is set as
<img src="Images/header_image.jpg"/>

It is shown in master page but not in child page which is situated in School/SchoolEntry.aspx path.

Please help me how to do it??

Regards,
Krunal Panchal
Posted
Updated 30-Jul-23 20:38pm

Try this:

<img src="../Images/header_image.jpg" />


or

<img src="~/Images/header_image.jpg" />
 
Share this answer
 
Have a look at this Tip to avoid such issues: Resolving Paths in a Multi-Folder WebSite[^]
 
Share this answer
 
Comments
Espen Harlinn 3-May-12 7:52am    
5'ed!
Sandeep Mewara 3-May-12 8:02am    
Yep. Thanks.
VJ Reddy 4-May-12 0:09am    
+5
Sandeep Mewara 4-May-12 1:20am    
Thanks.
Hi dear,

Understan the michanism to rout the file

    Root (0)
  • Images (1)
    • header_image.jpg (1.0)


  • School(1)

If your master page is Rool Directory (0) and image is at (1.0)
then you should have to travel minus step up to root by using the sign of "../"
So your image path is as under.
src="../Images/header_image.jpg"

I hope above is help full to u
 
Share this answer
 
can you try with following tag.Here i have given the path using the symbol ~

src="<%= Page.ResolveUrl("~")%>/Images/header_image.jpg"
 
Share this answer
 
v2
Comments
[no name] 3-May-12 6:42am    
Hi bhaskarareddy,

Thanks , but it is not working..

Regards,
krunal panchal
bhaskarareddy 3-May-12 6:51am    
src="<%= Page.ResolveUrl("~")%>/Images/header_image.jpg"
bhaskarareddy 3-May-12 6:45am    
i just have updated with different solution..please try it once
Espen Harlinn 3-May-12 7:50am    
5'ed, but change it to:
src='<%= Page.ResolveUrl("~")%>/Images/header_image.jpg'

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