Display Binary Image in ASP.Net GridView control using C# and VB.Net

Last Reply one year ago By dharmendr

Posted one year ago

I have a Gridview control and along with the name, surname and code of the employee I would like to place an image of the employee also. In the database I am using SQL server and the image is displayed as data type 'image'. Is it possible to place the image inside the gridview control.

This is my code to populate the Gridview from back end:

            Using conn As New SqlConnection(ConfigurationManager.ConnectionStrings("##").ConnectionString)

                Using cmd As New SqlCommand("SELECT Code, (FirstName + ' ' + LastName) AS [Employee Name] , EmployeeID ,DateOfMedical , Certificate FROM  MedicalCertificate Order By DateOfMedical ASC", conn)

                    Dim sda As New SqlDataAdapter(cmd)
                    Dim dt As New DataTable()


                    GridView1.DataSource = dt


                End Using

            End Using

        Catch ex As Exception

        End Try


Posted one year ago