Click here to Skip to main content
15,881,248 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I created slider on masterpage, the images of the slider are inside "slider images" folder. my default page is naked in the solution explorer. so the slider works fine there. but my "About US" page is inside new folder and the problem is the slider doesnot show images on the about us page. can anyone help please..
Posted
Updated 2-Aug-15 22:06pm
v2
Comments
DamithSL 3-Aug-15 4:37am    
can you show the code of slider?
Waqas Nowsherwan 3-Aug-15 5:45am    
<%-- This is slider code below--%>

<div id="carousel-example-generic" class="carousel slide" data-ride="carousel">
<!-- Indicators -->
<ol class="carousel-indicators">
<li data-target="#carousel-example-generic" data-slide-to="0" class="active"></li>
<li data-target="#carousel-example-generic" data-slide-to="1"></li>
<li data-target="#carousel-example-generic" data-slide-to="2"></li>
<li data-target="#carousel-example-generic" data-slide-to="3"></li>
</ol>

<!-- Wrapper for slides -->
<div class="carousel-inner">
<div class="item active">
<img src="slider images/responsive-slider.png" alt="Image is Broken"/>
<div class="carousel-caption">

Sharks


</div>
</div>
<div class="item">
<img src="slider images/04.jpg" alt="Image is Broken"/>
<%--<div class="carousel-caption">

Caption Text


</div>--%>
</div>
<div class="item">
<img src="slider images/02.jpg" alt="Image is Broken"/>
<%-- <div class="carousel-caption">

Sharks


</div>--%>
</div>
<div class="item">
<img src="slider images/slider-86_3.jpg" alt="Image is Broken"/>
<%--<div class="carousel-caption">

Caption Text


</div>--%>
</div>
</div>

<!-- Controls -->

<span class="glyphicon glyphicon-chevron-left"></span>


<span class="glyphicon glyphicon-chevron-right"></span>

</div> <!-- Carousel -->
DamithSL 3-Aug-15 6:24am    
where are you hosted your application? can't you give full image url as image src?
Waqas Nowsherwan 3-Aug-15 6:10am    
?
Waqas Nowsherwan 3-Aug-15 6:07am    
i can't see any more answers here

1 solution

Despite your master page being in the root folder it is executed in the context of the content page you are viewing. So code like this

XML
<img src="slider images/slider-86_3.jpg" alt="Image is Broken"/>


will work in a file in root as "slider images" is in root also, but when you look at a page in a sub-folder your url is now broken as there is no "slider images" in that folder. Use ResolveUrl to get the proper paths to your files instead of hard-coding them.

XML
<img src='<%=Page.ResolveUrl("~/slider images/slider-86_3.jpg")%>' alt="Image is Broken"/>
 
Share this answer
 
Comments
Waqas Nowsherwan 4-Aug-15 3:50am    
with this code its still not working, the same problem exists
F-ES Sitecore 4-Aug-15 4:01am    
View the source of the page and see if there is anything obviously amiss, and use the browser's dev tools (the network section) to see if there are resources it is trying to load but can't, that might point you in the right direction. You just have to make sure all of your urls are correct from the point of the content page, not the master page.

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