Bineesh  Viswanath

Bineesh Viswanath

  • NA
  • 1k
  • 780.1k

Display Image using DataList Control in ASP.NET

Aug 28 2013 2:58 AM
Sir, I am doing a DataList Control program in ASP.NET
 
My Task is to retrieve image and name from database and display using DataList.

I did the function: uploading, saving.

But my DataList is not visible in runtime. I want your help in this.

now i want to view images in DataList Control.

here the code I using to Load Image to DataList(dlImages).

public void GalleryView()
    {
        if (sqlCon.State == ConnectionState.Closed)
        {
            sqlCon.Open();
        }
        SqlCommand cmd = new SqlCommand("imageViewAll", sqlCon);
        SqlDataAdapter sqlda = new SqlDataAdapter(cmd);
        DataTable dtbl = new DataTable();
        dlImages.DataSource = dtbl;
        dlImages.DataBind();
        dlImages.Attributes.Add("bordercolor", "black");
    }

And called it in page_Load()

 protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            GalleryView();
          
        }
       
    }



Answers (7)