search envelope-o feed check
Home Unanswered Active Tags New Question
user comment-o

Scheduler add ResourceColumn programmatically

Asked by Davide
11 years ago.

Hi,

I'm using the scheduler and i would like to add programmatically ResourceColumn.
My sample code is:

DataTable dt = dl.SelectRooms();
DayPilotScheduler1.Resources.Clear();
int i = 0;
foreach (DataRow r in dt.Rows)
{
Resource res = new Resource(r["room_name"].ToString(), r["id_room"].ToString());

ResourceColumn rc = new ResourceColumn("Test " + i.ToString());
res.Columns.Add(rc);

DayPilotScheduler1.Resources.Add(res);

i++;
}

I think my code is right, but i have no effect on DayPilotScheduler, only the Resource is created.
However, after the above code i try to read the each Column and all ResourceColumn are correctly valued:

foreach(Resource r in DayPilotScheduler1.Resources)
{
foreach (ResourceColumn c in r.Columns)
{
string str_readValue = c.InnerHTML;
}
}

There is something wrong on my code, or the scheduler doesn't permit to add programmatically ResourceColumn?

Thanks,
Davide

This question is more than 1 months old and has been closed. Please create a new question if you have anything to add.