HOWTO: Add columns programmatically in resources view
Applies to: DayPilotCalendar
Example (having the information about resources in dt DataTable):
foreach (DataRow dr in dt.Rows) {
DayPilotCalendar1.Column.Add(new Column((string)dr["name"], (string)dr["id"]));
}
You should call this code in Page_Load method. If you are using ViewState, it's enough to add it inside the conditional block (it will be stored in the ViewState for the subsequent calls):
if (!IsPostBack) {
foreach (DataRow dr in dt.Rows) {
DayPilotCalendar1.Column.Add(new Column((string)dr["name"], (string)dr["id"]));
}
}