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

Calendar taking a long time to switch days in Day view

Asked by Anonymous
4 years ago.

It is taking almost 2 to 3 minutes for the day to change from 1 day to another we have about 20 entries on each day. What could be the problem?

mvc
Answer posted by Dan Letecky [DayPilot]
4 years ago.

Most likely this is caused by loading more events than necessary. You can try limiting the event set using StartDate and Days properties.

See an example from the ASP.NET MVC 4 event calendar tutorial (http://code.daypilot.org/65402/event-calendar-for-asp-net-mvc-4-razor):

protected override void OnFinish()
{
  // update was not requested in the event handler using Update() or UpdateWithMessage()
  // skip event reloading
  if (UpdateType == CallBackUpdateType.None)
  {
    return;
  }

  Events = new EventManager().FilteredData(StartDate, StartDate.AddDays(Days)).AsEnumerable();

  DataStartField = "eventstart";
  DataEndField = "eventend";
  DataTextField = "name";
  DataIdField = "id";
}

Data-loading method:

public class EventManager
{
  public DataTable FilteredData(DateTime start, DateTime end)
  {
    SqlDataAdapter da = new SqlDataAdapter("SELECT * FROM [event] WHERE NOT (([eventend] <= @start) OR ([eventstart] >= @end))", ConfigurationManager.ConnectionStrings["daypilot"].ConnectionString);
    da.SelectCommand.Parameters.AddWithValue("start", start);
    da.SelectCommand.Parameters.AddWithValue("end", end);

    DataTable dt = new DataTable();
    da.Fill(dt);

    return dt;
  }
}
This question is more than 3 months old and has been closed. Please create a new question if you have anything to add.