Reputation: 165
Hi all my work environment is asp.net c# vs2008. My issue is this, i have a master page outside.master in shared folder.Inside it i have an image control with
<img src="App_Themes/Home/images/logo.png" />
i am referring this master page from in two sub pages. One is Index.aspx which is located in the root level and Secondly registration.aspx which is under masters folder. The problem is that when i run, the index.aspx will show the logo where registration.aspx is not showing the logo. Please tell me how to specify the path so that i will get logo in both pages.
Upvotes: 0
Views: 4037
Reputation: 4361
Tilde sign ~ will resolve for server side controls.
So you need to add runat="server"
as img
in HTML element.
Try this:
<img src="~/App_Themes/Home/images/logo.png" runat="server"/>
Upvotes: 3
Reputation: 51644
Try the following:
<img src="~/App_Themes/Home/images/logo.png" runat="server" />
Upvotes: 0
Reputation: 1223
The most foolproof method is to have something like this
<asp:Image runat="server" id="myImage" ImageUrl='<%# Eval("imageFile") %>' />
Then in the code-behind assign the variable imageFile to something like Server.MapPath("App_Themes/Home/images/logo.png");
Upvotes: 0