Hi,
I’m after some advice please. My aim is to setup a dynamic sort of roadmap. Visually this would need to be a grid comprising of twelve columns (represents the next 12 months) and then each activity would exists as a row.
So far I’ve got the grid displaying with the dynamic columns using this simple code:
DataTable table = new
DataTable();
var startDate = new DateTime(2015, 3, 1);
var months = Enumerable.Range(0,
11)
.Select(startDate.AddMonths)
.Select(m =>
m.ToString("yyyy MMMM"))
.ToList();
foreach (string month
in months)
{
table.Columns.Add(month);
}
The next chahlenge was get the rows to appear correctly. To enable this I created a simple test database table.
I then loop through each row of the tasking table and attempt to match the target_date value with the column date value, if I get a match I insert the data at the correct position
Here is the code I use:
foreach (DataRow
row in dtroadmapdata.Rows)
{
foreach (DataColumn
col in table.Columns)
{
if ((string)row["target_date"] == col.ColumnName)
{
DataRow dr = table.NewRow();
dr[col.Ordinal] = row["task"];
table.Rows.Add(dr);
}
}
}
So far so good. However instead of just displaying text I need to insert an image (ideally with an embedded hyperlink)
How can I accomplish this please, tricky because I have no template fields because the columns are creating on the fly.
Any suggestions greatly appreciated.