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

How to add Image with DataTable to GridView

2 Answers 113 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Antonio
Top achievements
Rank 1
Antonio asked on 06 Sep 2011, 07:11 PM
I'm trying to add an image object to a DataTable which makes filling the GridView does not,  work anyone know I can do?

Columns type Image:
table.Columns.Add(new DataColumn() { ColumnName = "Metadato", DataType = typeof(Image) });

Image btn_metadato = new Image();
btn_metadato.Source = new BitmapImage(new Uri("img/mapa_on.png", UriKind.Relative));

foreach (object objvalor in valorIndicador)
{
     row = new DataRow();
     row["Metadato"] = btn_metadato;
}                    

GridViewImageColumn imageColumn = new GridViewImageColumn();
imageColumn.HeaderCellStyle = this.Resources["HeaderCellStyle"] as Style;
imageColumn.Header = DTable.Columns[x].ColumnName;
Binding Rad = new Binding(DTable.Columns[x].ColumnName);
imageColumn.DataMemberBinding = Rad;
imageColumn.IsFilterable = false;
GridSerie.Columns.Add(imageColumn);

2 Answers, 1 is accepted

Sort by
0
Ivan Ivanov
Telerik team
answered on 12 Sep 2011, 11:19 AM
Hello Antonio,

I have prepared an example project for you. Please refer to it and inform us whether this solution meets your requirements.

Regards,
Ivan Ivanov
the Telerik team

Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

0
Antonio
Top achievements
Rank 1
answered on 21 Sep 2011, 07:14 PM
Thanks for the help, I have the image in my grid, but I need to link dynamically generated with different parameters to the image to go to another site, this is possible?
Tags
GridView
Asked by
Antonio
Top achievements
Rank 1
Answers by
Ivan Ivanov
Telerik team
Antonio
Top achievements
Rank 1
Share this question
or