I have used the below code to display image on top of the page. For condition1
div1.Visible = true;
div2.Visible = false开发者_如何学编程;
For condition2,
div1.Visible = false;
div2.Visible = true;
and the code in the aspx page is like this.
<div id="div1" runat="server" style="padding-left: 110px;">
<img src="~/images/Package-Summary.gif" alt="Package Summary" />
</div>
<div id="div2" runat="server" style="padding-left: 110px;">
<img src="~/images/Process-Billing.gif" alt="Process Billing" />
</div>
Here it doesnot show me the image, instead shows an error box in that part!! What might be the reason!!!
I think you need a relative path to the image:
<img src="../images/Process-Billing.gif" alt="Process Billing" />
Your images are using server-side paths, but they're not server-side controls. The divs surrounding them are server-side controls, which doesn't affect the images. Either convert the image controls to server-side or convert the paths to something the client can request (relative paths, ideally).
Actually your images are not picking the right path as you are using server path at client side. If you want to use root-relative path you should use server side Image control to assign path.
You can use an Image server control and can just change its source but I do not know what you exactly want. But on client you use relative path not root-relative path. For root-relative path you have to use server image control.
see the article
ASP.NET Web Project Paths
so it should be
<div id="div1" runat="server" style="padding-left: 110px;">
<img src="../images/Package-Summary.gif" alt="Package Summary" />
</div>
<div id="div2" runat="server" style="padding-left: 110px;">
<img src="../images/Process-Billing.gif" alt="Process Billing" />
</div>
or where ever your image directory is you can go back to your image directory by just adding another "../" before path to go back to image directory.
精彩评论