Click here to Skip to main content
13,287,856 members (38,035 online)
Rate this:
Please Sign up or sign in to vote.
See more:
i want to retrieve images from a database and display them in a tiled view(at least three on a row) but i don't know how to go about that could someone please shed light on this for me?
Posted 9-Dec-12 7:06am
choudhary.sumit 9-Dec-12 23:08pm
why don't you use DataList control?

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

<asp:DataList ID="dl" runat="server" RepeatDirection="Horizontal">
                    <asp:Image ID="img" runat="server" ImageUrl='<%#"~/images/"+Eval("image") %>' Width="160px"
                                    Height="169px" />

protected void Page_Load(object sender, EventArgs e)
    private void binddatalist()
        SqlConnection con = new SqlConnection(ConfigurationManager.AppSettings["Demo"]);
        SqlCommand cmd = new SqlCommand("select * from contact", con);
        SqlDataAdapter da = new SqlDataAdapter(cmd);
        DataTable dt = new DataTable();
        if (dt.Rows.Count > 0)
            dl.DataSource = dt;
Member 9465564 10-Dec-12 7:28am
Thank You. This will help display it horizontally but what if i have multiple rows hoe do i go about that?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web04 | 2.8.171207.1 | Last Updated 10 Dec 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100