|
|
Try the online demo:
AJAX-style event creating, moving, resizing, and deleting
Context menu
Day view
Work week view
Week view
Month view
Horizontal/vertical resources view
PostBack/AJAX/JavaScript event handling
Binding to XmlDataSource, SqlDataSource, DataTable, ArrayList
Custom event formatting
UpdatePanel compatibility
Context menuEvent context menuRight-clicking an event can open a context menu.
Adding context menuContext menu is a separate control (DayPilotMenu).
If you want to set a different context menu for certain events, you need to use BeforeEventRender event handler:
Example: protected void DayPilotCalendar1_BeforeEventRender(object sender, BeforeEventRenderEventArgs e) Context menu event handlingYou can choose a custom action for each menu item separately. It is possible that some menu item will execute JavaScript code and another one will execute PostBack or AJAX callback event. Define the action by setting MenuItem.Action property:
Applicable MenuItem propertiesThis is an overview of MenuItem properties that are applicable for a given Action value.
NavigateUrl actionThe menu item will be a standard hyperlink pointing to an URL defined by NavigateUrl property. The hyperlink will use target defined by NavigateUrlTarget property (you can use it to open the link in a frame or in a new window). The parameters are passed using {X} replacements:
JavaScript actionThe menu item will fire a custom JavaScript code defined in MenuItem.JavaScript. Example: <daypilot:daypilotmenu id="DayPilotMenu1" runat="server"> You can execute the AJAX callback action from you JavaScript. This example will show a confirmation dialog box before deleting an event: <daypilot:daypilotmenu id="DayPilotMenu1" runat="server"> Note: dpc1 is the value of DayPilotCalendar.ClientObjectName. If you don't specify ClientObjectName the object name will be the value of DayPilotCalendar.ClientID (usually something like DayPilotCalendar1 but it can be ctl00$ContentPlaceHolder1$DayPilotCalendar1 if you use master pages). PostBack actionThe menu item will fire a server-side event using PostBack. You should handle EventMenuClick event on the server (you can do it by double-clicking EventMenuClick event in the Properties window in Visual Studio) and apply the changes to your data source (usually a database). A typical EventMenuClick handler for PostBack will look like this: protected void DayPilotCalendar1_EventMenuClick(object sender, AJAX callback actionThe menu item will fire a server-side event using AJAX callback. In the handler, you should update your data source and call DataBind(). If you call Update() method the changes will be sent back to the client and the events will be redrawn according to the new state. A typical EventMenuClick handler for AJAX callback will look like this: protected void DayPilotCalendar1_EventMenuClick(object sender, Note that the same event handler is used for PostBack and CallBack events. You can detect the event source (PostBack or CallBack) by checking e.Source property. Note: When the MenuItemClick handler is invoked by AJAX callback, the state of page controls is not available (in contrast to PostBack). Note: If you do not use PostBack handling on your page (either for DayPilot or for any other control) you should turn off ViewState to improve the page performance. Server-side event arguments (EventMenuClickEventArgs)The EventMenuClick handler will receive information about the action performed on the client (this applies both to PostBack and CallBack). EventMenuClickEventArgs class contains the following properties: Client-side event argumentsThe following variables are available in the JavaScript handler:
DayPilot Pro is an advanced DayPilot edition. You can check a thumbnail overview of the most interesting features. There is also an online demo with all the features working (including the AJAX features). If you want to test the design-time support and API you can download a fully functional trial version. And if you like it, you can buy a full version with source code and 12 months of upgrades and support (with a 30-days money back guarantee). DayPilot Lite is a do-it-yourself open-source edition of DayPilot. Although it misses some DayPilot Pro features, there are thousands of developers using it to build calendar, personal scheduling, and resource booking applications. |