Note that there are some explanatory texts on larger screens.

plurals
  1. POPutting image in DataTable and setting table as datasource to gridview
    primarykey
    data
    text
    <p>I'm having problems with putting an image in a DataTable and setting this table as datasource to gridview, I've searched everywhere, but no I had no luck. Here is the problem:</p> <pre><code> private void populateGrid() { // Gets a datatable from a stored procedure DataTable ragTable = ProjetoBO.HistoricoRAGStatusProjeto(Convert.ToInt32(Session["idProjeto"])); int group= -1; int cont = 1; var table = GetDataTable(ragTable); DataRow dataRow = table.NewRow(); foreach (DataRow row in ragTable.Rows) { cont++; if (Convert.ToInt32(row[9]) != group) { cont = 1; group= Convert.ToInt32(row[9]); table.Rows.Add(dataRow); dataRow = tabelaFinal.NewRow(); } dataRow[0] = DateTime.Parse(row[2].ToString()).ToShortDateString(); //putting some random image just for testing purpose dataRow[cont] = Properties.Resources.myIcon; } //my grid histRagStatus.DataSource = table ; histRagStatus.DataBind(); } //Creates a dataTable with the columns I need private DataTable GetDataTable(DataTable ragTable) { var newTable= new DataTable(); newTable.Columns.Add("Date"); foreach (DataRow row in ragTable.Rows) { if (!newTable.Columns.Cast&lt;DataColumn&gt;().Any(column =&gt; column.ColumnName.Equals(row[6].ToString()))) { var newColumn= new DataColumn(row[6].ToString()); newTable.Columns.Add(newColumn); } } return newTable; } </code></pre> <p>I've been trying everything I can, creating a new column like var newColumn= new DataColumn(row[6].ToString(),typeof(Bitmap)); / converting to an image and putting there / changing the datatype of the column before adding to the DataTable... But no luck... I just need the right way to get an image from Properties.Resources and putting it on a DataTable, that will bind to a grid and the image will appear on the gridview...</p> <p>Any help is precious to me right now =D</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload