Click here to Skip to main content
15,905,914 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello Friends...


I m currently working on ASP.NET dynamic project where it collects images from Application folder "Images" and displayed them on pages. I have coded it as follows

XML
<% for (int i=0;i<filenames.Length; i++) %>
             <% { %>
                <% System.IO.FileInfo ObjFileInfo = new System.IO.FileInfo(filenames[i].ToString()); %>
                <div class="templatemo_product_box">
                    <h1>
                        Material Code : <span><%= ObjFileInfo.Name.Substring(0,7) %></span></h1>
                    <div class="product_info">

                        <img src="<%@ ObjFileInfo.FullName %>" height="255" width="250" />
                    </div>
                    <div class="cleaner">
                        &nbsp;</div>
                </div>
                <div class="cleaner_with_width">
                    &nbsp;</div>
                    <% } %>



But it threw an error as

"The Server block is not well formed."

on following code

XML
<div class="product_info">

                        <img src="<%@ ObjFileInfo.FullName %>" height="255" width="250" />
                    </div>



i have also changed it as follows

XML
<div class="product_info">

                        <img src="<%# ObjFileInfo.FullName %>" height="255" width="250" />
                    </div>



But it doesn't display any images, just created html divs for it.

Please help to resolve an issue and display images on page at run time.
Posted
Comments
F-ES Sitecore 28-Sep-15 4:30am    
Have you tried <%= instead?
TAUSEEF KALDANE 28-Sep-15 5:42am    
yes, but it didn't display images
F-ES Sitecore 28-Sep-15 8:27am    
If you view the source of the page is there anything in the src attribute? It could be the code is working but whatever is in FullName is not a valid image url.

1 solution

 
Share this answer
 

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