<< Edit scheduler resources  >> Show source code for this site
An example shows how to add and delete ResourceRow objects. These objects are added as Finishing child rows.

Resources:

Name:

BackColor:


A classic postback mechanism is used to call server events. A callback can also be used. When one of Add, Change, Delete buttons is pressed an appropriate server event introducing changes to ResourceRow objects collection is called. ResourceRow objects are managed as a tree. This page allows to edit "Finishing" row child objects. Therefore to access a ResourceRow objects collection, a row corresponding to "Finishing" must be read. To this effect an Sch.Rows[2] instruction should be executed. It uses a fact that it is a second row in a main branch. An object can be read because it was assigned a ResourceID=="3" identifier. A call to Sch.Rows["3"] will search for a row with this identifier. This method to search for ResourceRow objects is more convenient as objects are searched on all levels of a tree (a whole tree), not only one branch.
After an appropriate row is found, an object from a row.ChildRows (Sch.Rows[2].ChildRows or Sch.Rows["3"].ChildRows) collection pointed to by a "Resources" list is added, changed or deleted.
Additionally a color of a given row can be changed. Selecting a color on a "BackColor" list will result in changing a ResourceRow.BodyStyle.BackColor property of a main grid of a control and (regardless of a value of a ResourceRow.HeaderStyle.BackColor property) for a list (tree) of resource objects in a left part of a control. Similarly other parameters of row displayed such as type, font color etc. can be changed.
All operations use postbacks so calling a method refreshing contents of a GoControl.RefreshClientControl() client control is not required.

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.