Click here to Skip to main content
15,886,724 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Why Image is not displaying in GridView and Image control named Image1?


My VB code is given below

VB
Try
            Dim sql As String = "SELECT PHOTO FROM IMAGE WHERE "
            sql += "ID='" & txtID.Text & "'"
            cmd = New OracleCommand(sql, Con)
            ds = New DataSet
            da = New OracleDataAdapter(cmd)

            Try
                If Con.State = ConnectionState.Closed Then
                    Con.Open()
                End If
            Catch ex As Exception
                Response.Write(ex.Message)
                Exit Sub
            End Try
            da.Fill(ds, "IMAGE")
            gvImages.DataSource = ds
            gvImages.DataBind()
            If Con.State = ConnectionState.Open Then
                Con.Close()
            End If


            Dim filepath As String = Server.MapPath(".\App_Data\temp\")
            Dim fullpath As String = filepath & "\"

            If Not (System.IO.Directory.Exists(fullpath)) Then
                System.IO.Directory.CreateDirectory(fullpath)
            End If
            Dim path As String = fullpath & lblblob.Text
            Image1.ImageUrl = path
            
        Catch ex As Exception
            Response.Write(ex.Message)
        End Try


I appreciate you in advance
Posted
Updated 19-Apr-12 1:12am
v3
Comments
ZurdoDev 19-Apr-12 12:02pm    
Have you stepped through the code to see what is going on?
Manoj Kumar Choubey 20-Apr-12 0:42am    
Please put Html code of gridview , and show Image1 control position is it in gridview ? are you using template field ?

1 solution

Change this line:
VB
gvImages.DataSource = ds

to
VB
gvImages.DataSource = ds.Tables(0)


Further, about 'path', make sure its correctly formed.
 
Share this answer
 

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