This is a migrated thread and some comments may be shown as answers.

display image in radgidview in vb.net

3 Answers 225 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Jack
Top achievements
Rank 1
Jack asked on 08 Sep 2010, 06:05 AM
hi all

i want to display image in rad gridview ,image name is save in database and image is save in application folder

how can i show in vb.net window application.

3 Answers, 1 is accepted

Sort by
0
Vassil Petev
Telerik team
answered on 08 Sep 2010, 09:03 AM
Hi goldy,

Adding an image column to the grid should be easy and straightforward. Please, review the documentation on how to add and use Image Columns to RadGridView. You can also review how image columns were implemented in our demos, which are installed with the controls.

Feel free to write back in case you have further questions.


All the best,
Vassil
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Jack
Top achievements
Rank 1
answered on 08 Sep 2010, 10:38 AM
thanks for reply

i know that example but its not working according to my coding and my coding is 

 Dim sql As String
        sql = "select * from teachertable"
        Dim ds As SqlDataReader
        ds = ob.getdate(sql)

        grdteacher.MasterGridViewTemplate.LoadFrom(ds)
        grdteacher.Columns(0).HeaderText = "Id"
        grdteacher.Columns(1).HeaderText = "Name"
        grdteacher.Columns(2).HeaderText = "Father's Name"
        grdteacher.Columns(3).HeaderText = "Mother's Name"
        grdteacher.Columns(4).HeaderText = "Date Of Birth"
        grdteacher.Columns(5).HeaderText = "Grnder"
        grdteacher.Columns(6).HeaderText = "Phone Number"
        grdteacher.Columns(7).HeaderText = "Email Id"
        grdteacher.Columns(8).HeaderText = "Date Of Joining"
        grdteacher.Columns(9).HeaderText = "Permanent Address"
        grdteacher.Columns(10).HeaderText = "Corresponding Address"
        grdteacher.Columns(11).HeaderText = "Salary"
        grdteacher.Columns(12).HeaderText = "Designation"
        grdteacher.Columns(13).HeaderText = "Qulification"
        grdteacher.Columns(14).HeaderText = "Photo"
        grdteacher.BestFitColumns()

in column 14 i want to display image
0
Jack
Telerik team
answered on 11 Sep 2010, 10:31 AM
Hello goldy,

In this case you should use CellFormatting in order to bind the image. Here is a sample:


void
radGridView1_CellFormatting(object sender, CellFormattingEventArgs e)
{
    if (e.CellElement.ColumnInfo.Name == "Image" && e.CellElement.RowInfo is GridViewDataRowInfo)
    {
        if (e.CellElement.Value != null && e.CellElement.Value != DBNull.Value)
        {
            e.CellElement.Image = LoadMyImage(e.CellElement.Value.ToString());
            return;
        }
    }
    e.CellElement.Image = null;
}

I hope this helps.

Best wishes,
Jack
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
GridView
Asked by
Jack
Top achievements
Rank 1
Answers by
Vassil Petev
Telerik team
Jack
Top achievements
Rank 1
Jack
Telerik team
Share this question
or