7
Answers

Display Image using DataList Control in ASP.NET

Bineesh  VP

Bineesh VP

11y
7.5k
1
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)