<< Add new scheduler items  >> Show source code for this site
An example demostrates how to add two linked SchedulerItem objects.
Objects will be added to a Project 1 | Bathrooms resource.
Adding is performed by server code called using a callback.


 
You can use a callback to removing items too. First, you need click appropriate item.



You can set appearance of the items' rectangles:
Adding is performed by server code, but it is initiated by pressing a button on a HTML page in a browser. After a button is pressed a client JavaScript AddButton_onclick() is called. Using a GoControl.DoAction() method it calls a server event.
A GoControl.Action event is called. A way it works can be controlled using GoControl.EventAction property settings. A call uses callback so whole operation is performed in a background without a browser reading a whole page again.
A server addItems() method called by a method handling a Sch_Action() event adds two new SchedulerItem objects to a collection. It is important that they are added to a ResourceRow.Items collection, not to Scheduler.Items. This means that before adding these objects, appropriate ResourceRow object items will be added to should be read.
The last operation after adding (changing) is to call a Scheduler.RefreshClientControl() method. It informs a server scheduler control that it should prepare data refreshing contents of a client scheduler control in a browser. Without a call to this method, changes made by server code would not affect HTML page. Refreshing is required only when callback events are handled.

If you would look into a source code for this demo, click on the link.
For demonstration purposes all appointments displayed on a calendar are stored in ASP.NET session objects, so original values are restored immediately after a new session object is created.
A list of appointments and resources is intialized every time a new session is started.