In the below code i am trying to display image inside a panel.But my image cannot access the image from C directory and place inside panel.Pls any one me to solve the issue
docimg.ImageUrl = #"C:\Search\Seardoc\Documents\Desert.jpeg";
imgPnl.BackImageUrl = docimg.ImageUrl;
<asp:Panel ID="imgPnl" runat="server">
<asp:Image ID="docimg" runat="server" Width="100px" Height="100px" /></asp:Panel>
use file:/// before the image name
#"file:\\\C:\Search\Seardoc\Documents\Desert.jpeg";
Example
CSS background image URL failing to load
Related
My image is hosted inside the listview.
<asp:Image ID="Image1" ImageUrl='<%# Eval("BannerPath","AffiliateBanners/{0}") %>' Width="100" Height="100" runat="server" />
The listview works well. It fetches and displays all the items.
The problem is that the image isnt loaded.
I checked the path of the image, it is the right path and the image loads.
The strange thing is after loading the image in the browser by copying and pasting the image path from the browser inspector (Chrome/Firefox), and browsing back.. the image loads successfully on the page.
Why is that? and how can I make it load ?
Try one of these (probably the 2nd or 3rd one, or something similar):
ImageUrl='<%# Eval("BannerPath","~/AffiliateBanners/{0}") %>'
ImageUrl='<%# string.Format("AffiliateBanners/{0}", Eval("BannerPath")) %>'
ImageUrl='<%# string.Format("~/AffiliateBanners/{0}", Eval("BannerPath")) %>'
i have a panel in my asp.net website
And i am trying to add image in runtime like this
ASPX
<asp:Panel ID="pnl001" runat="server" Height="300px" Width="1174px" >
</asp:Panel>
Code behind
pnl001.BackImageUrl = "D:/mayur.jpeg"
please help. Thanks!
you can try this if you want to set background image of panel from codebehind
pnl001.BackImageUrl = #"D:/mayur.jpeg";
Why doesn't the image show up when the file extension is THM.
<ItemTemplate>
<asp:image id="ThumbImg" runat="server" imageurl='<%# GeThumb(Container.DataItem) %>' Width ="60px" Height = "60px" />
</ItemTemplate>
The above lines are within asp:gridview in ASPX page.
GetThumb returns url as below.
http://www.xyz.com/images/mythumbnailimage.THM
The image doesn't show on the grid and I don't get to see the typical RED Colored x mark but it is different. In any case the image doesn't show in the grid. The image file exists on the server but will render when I change extension to JPG or TIF.
So my question is what's wrong with THM files. What am I doing wrong here?
Thanks.
Found the image extensions (THM in my case) needs to be added in the server. Added and it started working.
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.
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"/>
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");
Try the following:
<img src="~/App_Themes/Home/images/logo.png" runat="server" />
I am loading an asp image into my site and its showing in the design view but when I run it on the local host it wont display the image.
<div><asp:Image ID="Image1" runat="server" src="~/images/FusionChart.png" /></div>
the image is stored in "images" folder within the root and the image name is the exact same as in the div so Im confused as to why is wont display. Any help would be appreciated.
Seems like your path is incorrect. Please read this article, may be help you
http://msdn.microsoft.com/en-us/library/ms178116.aspx
If not there is different
<asp:Image ID="Image1" runat="server" ImageUrl="~/images/FusionChart.png"/>
<img src="~/images/FusionChart.png" alt=""/>
Change the src attribute name to ImageUrl property name