Click here to Skip to main content
15,905,144 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a List View With Images...I need to display the name of the image...below the image the should be display...using C# .net windows application
Posted

1 solution

Hi,
I don't know whether you save image URLs in your database or a binary data. If you save image's addresses in your db, then, you can you this piece of code to show images in the ListView. You can show every data after or before images:
XML
<asp:DataList ID="DataList1" runat="server" DataSourceID="SqlDataSource1" 
            RepeatColumns="5">
            <ItemTemplate>
                <asp:Image runat="server" ID="img1" ImageUrl='<%# Eval("Text") %>' />
                <br />
                <asp:Label Text='<%# Eval("StartYear") %>' runat="server" ID="txt"></asp:Label>
            </ItemTemplate>
        </asp:DataList>

XML
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:YourConnectionName %>"
           SelectCommand="SELECT top 10 [Text], [StartYear] FROM [tbl_FishMessage]">
       </asp:SqlDataSource>


I hope it helps,
Cheers.
 
Share this answer
 
v3

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