55 pts.
Q:
how to display images from database on datalist in asp.net 2.0
Dear all,
Please help me ,how to display images from database on datalist  in asp.net.my coding are mention below,all my records are display but images are not display.

HTML CODE:-
<asp:DataList ID="DataList1" runat="server" BackColor="White" BorderColor="#336666"
            BorderStyle="None" BorderWidth="0px" CellPadding="15" GridLines="Both" CssClass="normal-txt" HorizontalAlign="Center" RepeatColumns="2" RepeatDirection="Horizontal" ShowFooter="False" ShowHeader="False" Width="60%" >
            <FooterStyle BackColor="White" ForeColor="#333333" />
            <ItemStyle BackColor="White" ForeColor="#333333" />
            <SelectedItemStyle BackColor="#339966" Font-Bold="True" ForeColor="White" />
            <HeaderStyle BackColor="#336666" Font-Bold="True" ForeColor="White" />
            <ItemTemplate>
                 <table style="width: 227px" visible=true>
                    <tr>
                        <td align="center" colspan="3" rowspan="3" valign="middle">
                            <asp:Image ID="Image1" runat="server" ImageUrl='<%# DataBinder.Eval(Container.DataItem, "ImagePath") %>'   Height="154px" Width="128px" > </asp:Image > </td>
                    </tr>
                    <tr>
                    </tr>
                    <tr>
                    </tr>
                </table>
                <br />
                                      
                 <br />
                    
            </ItemTemplate>
        </asp:DataList>

CS CODING
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
using System.Configuration;
using System.Web.Mail;

public partial class datalist : System.Web.UI.Page
{
  
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            try
            {

                SqlConnection con = new SqlConnection("server=SERV2005;uid=sa;pwd=sa12345;database=PERDB");
                con.Open();
                DataSet ds1 = new DataSet();
                SqlDataAdapter ad = new SqlDataAdapter("select * from Productdetails where categoryname='homePageProducts'", con);
                ad.Fill(ds1);
                DataList1.DataSource = ds1;
                DataList1.DataBind();
         
            }
           catch (Exception ex)
            {
                Response.Write(ex);
            }
         }
     }
   
}
ASKED: Nov 12 2009  9:14 AM GMT
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
55 pts.
A:
 RATE THIS ANSWER
0
Click to Vote:
  •   0
  •  0
  • Bookmark and Share
Last Answered: Nov 12 2009  9:14 AM GMT by Amitshukla   55 pts.
Discuss This Answer:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _