|
|
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
Time range selectingEnable time range selectingBy default, time range selecting is disabled. You can enable it by setting DayPilotCalendar.TimeRangeSelectedHandling property to one of these values:
TimeRangeSelectedHandling.PostBackIf you set TimeRangeSelectedHandling to TimeRangeSelectedHandling.PostBack, each time selection will send a PostBack to the server. You should handle TimeRangeSelected event on the server (you can do it by double-clicking TimeRangeSelected event in the Properties window in Visual Studio) and apply the changes to your data source (usually a database). You can add a new event directly from the code: protected void DayPilotCalendar1_TimeRangeSelected(object sender, Or you can redirect it to another page where you enter the event details: protected void DayPilotCalendar1_TimeRangeSelected(object sender, TimeRangeSelectedHandling.CallBackIf you choose CallBack handling, each time selection will execute an AJAX callback to the server. 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 sample TimeRangeSelected handler for AJAX callback will look like this: protected void DayPilotCalendar1_TimeRangeSelected(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 EventResize 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 (TimeRangeSelectedEventArgs)The TimeRangeSelected handler will receive information about the action performed on the client (this applies both to PostBack and CallBack). TimeRangeSelectedEventArgs class contains the following properties: TimeRangeSelectedHandling.JavaScriptYou can also handle the time selection event on the client side. JavaScript handler can be used especially for:
Redirecting sample: DayPilotCalendar1.TimeRangeSelectedHandling = UserActionHandling.JavaScript; <script type="text/javascript"> Sample that asks user for confirmation before executing PostBack: DayPilotCalendar1.TimeRangeSelectedHandling = UserActionHandling.JavaScript; <script type="text/javascript"> Sample that executes callback: DayPilotCalendar1.TimeRangeSelectedHandling = UserActionHandling.JavaScript; <script type="text/javascript"> 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). Client-side event argumentsThe following variables are available in the JavaScript handler:
TimeRangeSelectedHandling.HoldIn this case, the selection remains active and context menu is available. The context menu can be set using ContextMenuSelectionID property. Example code (run this example):
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. |