Home Unanswered Active Tags New Question

Resources - Can I get them from a sqldata source or do I have to programatically add them?

Hi,

I'm developing a hire application and am using the trial version of DayPilotScheduler.

I am having difficultly getting Resource data into the Scheduler.Do I HAVE to programatically add Resources or is there a simpler method? i.e. can I just extract them from a sqldataadapter?

Any sample code?

thanks

Asked by John 3 years ago.
Replies
You should fill the Resources collection manually:
protected void Page_Load(object sender, EventArgs e)
{
// I assume that resources are loaded in dtResources DataTable
foreach (DataRow dr in dtResources.Rows) {
DayPilotScheduler1.Resources.Add(new Resource(dr["name"], dr["id"]);
}
}

The Resources collection is stored in the ViewState so it's possible to place this init code inside if (!IsPostBack) block. However, the ViewState for DayPilotScheduler is usually very large - I recommend turning it off and placing the initialization code outside of if (!IsPostBack).
Comment posted by Dan Letecky 3 years ago.
Do you mean that it is best to turn off the view state for the scheduler control?
Comment posted by John 3 years ago.
Yes:
  1. It stores all the events. That is convenient sometimes (you don't have to rebind after CallBack/PostBack) but it means that all events are sent twice to the client (once inside ViewState and once in JSON object). But what's worse, it's also sent back with all requests (PostBacks/CallBacks).
  2. It's not necessary to turn ViewState off until you see the slowdown. But it's the first thing you can do to improve performance.
Comment posted by Dan Letecky 3 years ago.
New Reply
This reply is
Your name (optional):

DayPilot for ASP.NET WebForms, DayPilot for ASP.NET MVC, DayPilot for Java