Click here to Skip to main content
15,893,487 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Sir i want ro retrieve image from database and display in listview in asp.net.
but my images are broken while loading page on browser. please guide me what mistake i do here. please light on my problem as soon as possible. your answer will be appreciated. thanks in advance...for further detail please see my code below.
ASP.NET
<div class="column_w430 fl vl_divider">
          
                <asp:ListView ID="ListView1" runat="server" DataKeyField="ID" 
                DataSourceID="SqlDataSource1">
                
                <ItemTemplate>
                <table>
                <tr>
                
                <td >
                 
                    <asp:ImageButton ID="ImageButton1" runat="server"
                                     Height="118px" 
                                    ImageUrl='<%# Eval("ImagePath")%>' headlines='<%# Eval("headlines")%>' 
                                     Width="170px" />
                
                
                               </td>
                             
                                
                               </tr>
                               </table>
                 
                </ItemTemplate>
                </asp:ListView>

                 </div>

<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:BOLKASHMIRConnectionString %>"
SelectCommand="SELECT [ID], [headlines], [ImagePath] FROM [Taza_Treen] ORDER BY [ID]">
Posted
Comments
Richard Deeming 30-Nov-15 14:17pm    
What's the value in the ImagePath column in the database?
Does the image exist in that path?

1 solution

In your database you can have relative or absolute path for the images, for example
http://yourdomain.com/images/example.png

images/example.png

check the value in ImagePath column and make sure it has ether valid absolute path or valid relative path.
 
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