<< Edit scheduler's texts  >> Show source code for this site
An example demonstrates how to limit editing texts in SchedulerItem and ResourceRow objects.
  • client events block editing texts starting with 'A',
  • client events do not allow to accept texts longer than 30 characters,
  • a server event changes entered text to capitals.

 

 

Apart from many other capabilities, a Scheduler object also allows editing text in SchedulerItem objects and columns of SchedulerRow objects. Editing texts is started by clicking on a given row or item. This causes opening a text editor.
Editing texts is possible only when appropriate flags of a Scheduler.BehaviorOptions property are on. A SchedulerBehaviorOptions.EditableItemText flag controls editing SchedulerItem objects, while SchedulerBehaviorOptions.EditableResourceText flag editing ResourceRow. Setting these flags off you can easily disable this functionality. In a similar way a SchedulerItem.Allows property with a SchedulerItemAllows.TextEdit flag turned on allows to selectively enable editing SchedulerItem objects chosen. A ResourceColumn.AllowEdit property determines whether editing is possible in a whole column, while ResourceRow.AllowEdit property in a whole row.
Apart from these settings before edit starts, a client EventItemTextEditing or EventRowTextEditing event is generated. These events can be handled by JavaScript code only and setting a Cancel argument to true value blocks changes. On this page this event was written in such a way that editing texts starting with 'A' is impossible. Try to starting edition of the scheduler item with e.g. Adam text in it, you will see the editor won’t appear.
After editing is finished a server-client EventItemTextEdited or EventRowTextEdited event is generated. Accepting a text entered can be implemented in this event. First a client event not allowing entering text longer than 30 characters is called. If a text is longer a Cancel argument is set to true and edit continues. Otherwise, a server event changing entered text to capitals is called using callback. Please notice that as text is changed in callback mode, an extra call to a GoControl.RefreshClientControl() method that will pass changes made to a client control is required. If a server did not change text but only ex. saved changes introduced calling this method would not be necessary.

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.