如何在telerik RadGrid中绑定图像代码...... [英] how to bind image code behind in telerik RadGrid......

查看:52
本文介绍了如何在telerik RadGrid中绑定图像代码......的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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...!!!!

推荐答案

尝试下面的代码,您需要存储与当前exe位置或完整物理路径相关的Photo路径

try below code, you need to store the Photo path related to current exe location or full physical path
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());
}





检查下面的线程

从DataTable到DataGridView,包括图像路径 [ ^ ]

DataGridViewImageColumn-动态设置每个网格行的图像 [ ^ ]


这篇关于如何在telerik RadGrid中绑定图像代码......的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆