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

How long are events stored in ViewState

Asked by James
11 years ago.

I set StoreEventsInViewstate to 'True' to preserve the events during partial postback. The DayPilot calendar is in an UpdatePanel.

Will DayPilot automatically flush the events from ViewState when it leaves its current range?

So, I am using the Day view and displaying 3 days. If I select a date that is outside of the 3 days stored in ViewState will those be removed?

I like using ViewState because it avoids having to connect to the DB on every postback. But, I am concerned that if there isn't any clean-up, ViewState will grow.

Thanks,
James

Answer posted by Dan Letecky [DayPilot]
11 years ago.

It's reset every time you call DataBind(). It only contains the latest event set loaded from DataSource.

I would recommend reloading events from the database instead of storing them in the ViewState.

Just comparing the network costs:

  • ViewState will increase the size of both the request and the response from the client (this is typically much slower connection, usually with much slower upload).
  • The database usually runs very close to the web server (maybe even on the same machine). This means at least a gigabit connection.
  • You want the latest version of the data set. With ViewState there is a delay of seconds, minutes, possibly even hours or days.

I would estimate that just parsing the ViewState string to load the events will take more time than loading it from the database. If I exaggerate a bit, by storing events in the ViewState you choose a text-file-based database connected through ADSL over an in-memory database connected through a local gigabit line.

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