Click here to Skip to main content
15,898,371 members
Please Sign up or sign in to vote.
3.00/5 (1 vote)
See more:
C#
using (DataTableAdapters.AbcTableAdapter Abc = new RRHFOEM04.DataTableAdapters.AbcTableAdapter())
            {
                DataTable dt = Abc.Abc_GetData();

                radGridView1.DataSource = dt;
                radGridView1.EnableFiltering = true;
                radGridView1.MasterTemplate.EnableFiltering = true;

                GridViewImageColumn imageColumn = new GridViewImageColumn();
                imageColumn.Name = "ImageColumn";
                imageColumn.FieldName = "Photo";
                imageColumn.HeaderText = "Picture";
                imageColumn.ImageLayout = ImageLayout.Zoom;
                radGridView1.MasterTemplate.Columns.Insert(4, imageColumn);
            }

in the above code table have one "Photo" column... and in this column store the image path... but in the RadGrid it is not display the image... so how can i do this...

Thanx in Advance...!!!!
Posted

1 solution

try below code, you need to store the Photo path related to current exe location or full physical path
C#
GridViewImageColumn col = new GridViewImageColumn("ImageColumn");
radGridView1.Columns.Add(col);

foreach (GridViewRowInfo row in radGridView1.Rows)
{
    row.Cells["ImageColumn"].Value = Image.FromFile(row.Cells["Photo"].Value.ToString());
}


check below threads as well
From DataTable to DataGridView including image path[^]
DataGridViewImageColumn - dynamically set images per grid row[^]
 
Share this answer
 
v3

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