Inserting an Image into a Column

W

W Akthar

Hi All,

I want to know how to insert an image into a datagrid
column.
I am using the following method to create a DataTabel
which I then add to a dataset and finally set the
datasource of datagrid to this dataset.


DataSet dsOrgs = GetAllContactNotesByContactID(id);
DataSet ds = new DataSet();
ds.Tables.Add(CreateDataTableContacts(dsOrgs));

DataView dv = new DataView(ds.Tables[0]);
dataGridNotes.DataSource = dv;
dataGridNotes.DataBind();

The method CreateDataTableContacts is as follows

private DataTable CreateDataTableContacts(DataSet ds)
{

DataTable aTable = new DataTable("Organisations");
DataColumn dtCol;
DataRow dtRow;
DataRow dsRow;
DataTable dsTable;

dtCol = new DataColumn();
dtCol.DataType= System.Type.GetType
("System.String");
dtCol.ColumnName = "Name";
dtCol.Caption = "Name";
aTable.Columns.Add(dtCol);

// ****************************************
// ****************************************

// How can I create this column into an
imagecolumn ??
dtCol = new DataColumn();
dtCol.DataType= System.Type.GetType
("System.String");
dtCol.ColumnName = "Logo";
dtCol.Caption = "Logo";
aTable.Columns.Add(dtCol);

// ****************************************
// ****************************************


dtCol = new DataColumn();
dtCol.DataType= System.Type.GetType
("System.String");
dtCol.ColumnName = "Status";
dtCol.Caption = "Status";
aTable.Columns.Add(dtCol);

dsTable = ds.Tables[0];
for(int row=0; row < dsTable.Rows.Count; row++)
{
dsRow = dsTable.Rows[row];
dtRow = aTable.NewRow();

dtRow["Name"] = dsRow[2].ToString
().TrimEnd();

int logoID = Int32.Parse(dsRow[4].ToString
().TrimEnd());

// ****************************************
// ****************************************
switch
{
case 0:
break;
case 1:
break;
case 2:
break;
case 3:
break;
}
// ****************************************
// ****************************************

int statusID = Int32.Parse(dsRow
[3].ToString());
string status = GetStatusByStatusID
(statusID);
dtRow["Status"] = status.TrimEnd();

aTable.Rows.Add(dtRow);
}

return aTable;
}



Can anyone help please ????????
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,819
Latest member
masterdaster

Latest Threads

Top