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

How can I dynamically change resources and event based on navigator in schedular?

Asked by Anonymous
11 years ago.

Hi, i use the scheular control with navigator.

I want to show the data which is based on the perticular date.

First time i navigate to page then it shows the data for the date which is in navigator but once i click on some other date then how to bind the data to schedular for that date.

Comment posted by Anonymous
11 years ago.

I did like this.

protected void Page_Load(object sender, EventArgs e)
{
#region Data loading initialization


if (Session["Day"] == null)
{
Session["Day"] = DataGenerator.GetData();
}
table = (DataTable)Session["Day"];
DayPilotNavigator1.DataSource = Session["Day"];
DayPilotScheduler1.DataSource = Session["Day"];
#endregion

if (!IsPostBack)
{
DayPilotScheduler1.StartDate = DateTime.Today;
DataBind();
}
}

and for navigator

protected void DayPilotScheduler1_Command(object sender, DayPilot.Web.Ui.Events.CommandEventArgs e)
{
switch (e.Command)
{
case "navigate":
DayPilotScheduler1.StartDate = (DateTime) e.Data["start"];

table = GetSomeOtherData();

table.AcceptChanges();
DayPilotScheduler1.DataBind();
DayPilotScheduler1.Update(CallBackUpdateType.Full);}

break;
}
}

I was assuming when iupdate the datatable it will reflect on schedular.. but it is not happening.

any idea?

I have not put schedular control inside the update pannel.

Thanks.

Comment posted by Dan Letecky
11 years ago.

I would try adding the following line to the case "navigate" section:

case "navigate":
DayPilotScheduler1.StartDate = (DateTime) e.Data["start"];
table = GetSomeOtherData();
table.AcceptChanges(); // this is probably not necessary (when loading the data)
DayPilotScheduler1.DataSource = table;
DayPilotScheduler1.DataBind();
DayPilotScheduler1.Update(CallBackUpdateType.Full);}

Comment posted by Dan Letecky
11 years ago.

Once again: My previous post might not be correct. I assumed you were loading your data using GetSomeOtherData() method.

Generally, what you do seems to be correct. What happens to the scheduler when you change the date using navigator?

  1. Does the date change (in the header of the schedule)? If you are showing just hours of day try to print the date as well to make sure.
  2. Do the events stay in the scheduler or do they disappear?

I would also try to get rid of the Session for loading/storing the data. In a real application you will want to do a DB query before calling DataBind and limit that query using StartDate and Days properties (to get only the relevant data).

Comment posted by Anonymous
11 years ago.

I tried with your updates.

DayPilotScheduler1.DataSource = table;

it works fine, But as you said it works for first navigation only. after first navigation i got the error _pendingCallbacks[i] is undefined and date on schedular control is not changing.

I dont know why this is happening.

I am using navigator with VisibleRangeChangedHandling="CallBack"

thanks

Comment posted by Dan Letecky
11 years ago.

The "__pendingCallbacks[i] is undefined" error is a bug of DayPilot Pro 5.1 SP2 release. It was fixed in DayPilot Pro 5.2.

Please try to update to 5.2 and let me know if the error is still there.

Comment posted by Anonymous
11 years ago.

Hi, Thanks for the update.

I test the release 5.2.

It working fine.

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