Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: ASP.NET
Hi,
I have a problem in my project.the problem is as:-
I make a Master page and in a div set a background image.After loading the master page on another form the image display but at run time Image is not displaying.
Plz give any solution for this.
Posted 23-Mar-11 21:02pm
Edited 23-Mar-11 21:30pm
v2
Comments
mkgoud at 24-Mar-11 2:13am
   
Not clear.
SURBHI TYAGI at 24-Mar-11 2:16am
   
i set the background of div by a image at master page but its not shown at run time.
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

To access the methods and properties of a master page from code in a content page, you can use the FindControl method:
Image imgOnMasterPage = (Image)
  (this.Master.FindControl ("ImageName"));
if(imgOnMasterPage != null)
{
//    Do as your wish
}
  Permalink  
v2
Comments
Bhavna v at 25-Mar-11 6:41am
   
That is important one
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

If you are using the Image server control, or placing the images on your page through your code behind, you should reference the images using the "~/" syntax to refer to the application root. So if the image is in the root of your application's directory structure you could reference it through "~/logo.gif". If you had it stored in a folder called "images" you would use "~/images/logo.gif", etc.
  Permalink  
Comments
SURBHI TYAGI at 24-Mar-11 2:36am
   
i set the image by style property.....thn this problem occur.by image server control it will display.
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 4

U can create a folder as Image in your application now place your images in that in master page take an Image control in Div tag as u have taken.
Now set the properties of Image Control as per your choice but pay attention on ImageUrl property.
<asp:Image ID="Banner" Width="100%" Height="100px" runat="server" ImageUrl="~/image/your.jpg" />
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 5

This should work.
<div id="MasterContent" style="background:url(/Images/Image.jpg);">
 
using css is always a better option.
<script style="css">
{
.background { background:url(/Images/Image.jpg);}
}
<div id="MasterContent" class="background"></script>
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 6

I got the Exact solution here
 
http://microsoftdotnetsolutions.blogspot.in/2013/04/display-gif-image-in-when-aspx-page.html
  Permalink  

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

  Print Answers RSS
0 OriginalGriff 215
1 George Jonsson 175
2 Kornfeld Eliyahu Peter 159
3 PIEBALDconsult 110
4 Richard MacCutchan 85
0 OriginalGriff 6,080
1 DamithSL 4,648
2 Maciej Los 4,087
3 Kornfeld Eliyahu Peter 3,624
4 Sergey Alexandrovich Kryukov 3,294


Advertise | Privacy | Mobile
Web01 | 2.8.141220.1 | Last Updated 18 Apr 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100