TelerikDeveloper.com

TelerikDeveloper.com

sgray128 4/15/2016 11:20:48 AM

GridViewImageColumn

Sample code relating to the GridViewImageColumn



Step on would be to create a table in SQL with an image field

 

INSERT INTO fpimage(ImageBlob,ImageName, Height, Width)
SELECT BulkColumn , 'Pixel',1,1
    FROM Openrowset( Bulk 'G:\projects\NGB\Common Images\Pixel.png', Single_Blob) as EmployeePicture

Step two would be to include that field in your grid query, and display it like this

Function createGridViewImageColumn(ByVal strHeaderText As String, ByVal strFieldName As String,
                                    ByVal intWidth As Int16, bVisible As Boolean) As GridViewImageColumn
    Dim ImageColumn As New GridViewImageColumn()
    ImageColumn.IsVisible = bVisible
    ImageColumn.Name = strFieldName
    ImageColumn.HeaderText = strHeaderText
    ImageColumn.FieldName = strFieldName
    ImageColumn.TextAlignment = System.Drawing.ContentAlignment.MiddleCenter
    ImageColumn.Width = intWidth
    Return (ImageColumn)
End Function