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

Event Calendar only shows current day

Asked by Jacob
9 years ago.

Hi,

I cant seem to get the Event Calendar to show more than the current day.

My Controller looks like this currently:

public ActionResult BackEnd()
{
return new Dpc().CallBack(this);
}

}

public class Dpc : DayPilotCalendar {
protected override void OnInit(InitArgs e)
{
Days = 7;
Events = new EventManager().FilteredData(StartDate, StartDate.AddDays(Days)).AsEnumerable();
DataStartField = "eventstart";
DataEndField = "eventend";
DataTextField = "text";
DataIdField = "id";
Update();
}

}

public class EventManager {
public DataTable FilteredData(DateTime start, DateTime end) {
DataTable table = new DataTable();

DataColumn column;

column = table.Columns.Add();
column.ColumnName = "id";
column.DataType = typeof(Guid);

column = table.Columns.Add();
column.ColumnName = "text";
column.DataType = typeof(string);

column = table.Columns.Add();
column.ColumnName = "eventstart";
column.DataType = typeof(DateTime);

column = table.Columns.Add();
column.ColumnName = "eventend";
column.DataType = typeof(DateTime);

DataRow row1;

row1 = table.NewRow();
row1["id"] = Guid.NewGuid();
row1["eventstart"] = DateTime.Now;
row1["text"] = "TestText";
row1["eventend"] = DateTime.Now.AddHours(2);
table.Rows.Add(row1);

DataRow row2;

row2 = table.NewRow();
row2["id"] = Guid.NewGuid();
row2["eventstart"] = DateTime.Now.AddDays(2);
row2["text"] = "TestText2";
row2["eventend"] = DateTime.Now.AddDays(2).AddHours(2);
table.Rows.Add(row2);

return table;
}
}

and my view is simply

@using DayPilot.Web.Mvc;
@using DayPilot.Web.Mvc.Events.Calendar;
@using DayPilot.Web.Mvc.Enums.Calendar;

@Html.DayPilotCalendar("dpc", new DayPilotCalendarConfig {
BackendUrl = Url.Content("~/Home/Backend")
})

I would like to be able to control which days are shown in the calendar. Any help?

Thank you.

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