Click here to Skip to main content
15,880,503 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i created one master page in that master page i designed one image and menu's after that my requirement i put all the web pages in one folder when ever i add to the master page to that webpages the image is not Binded to the webpages
Posted

Please note that if you use relative paths for images on your master page then those relative paths are relative to the path of the actual aspx pages that use this master page. Most probably your paths are relative to the presence of master page. The best way to deal with this scenario is to use server image control with following kind of syntax:

<asp:Image id="i1" runat="server" ImageUrl="~/Images/Image1.gif" EnableViewState="false" />


using a "~/" automatically begins with the root of the virtual path. However if you are using html img control without using runat=server then you won't be able to use the~/ syntax, in such cases you may come up with a custom function in lines with these link http://forums.asp.net/t/1374426.aspx/1[^] and ResolveUrl in ASP.NET - The Perfect Solution[^]

Regards
Pawan
 
Share this answer
 
Comments
_Amy 19-Feb-13 23:19pm    
+5!
Rai Pawan 20-Feb-13 0:05am    
Thanks _Amy. Appreciate your input solution also.
- Pawan
Solution 1 is the exact solution of what you are looking for. But, I would like to add some more input to that.
ASP.Net Master Pages: Tips, Tricks, and Traps[^]
Asp.Net : Master Pages[^]
MSDN : Master Pages[^]


--Amit
 
Share this answer
 

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