Click here to Skip to main content
15,881,248 members
Articles / Web Development / HTML

DayPilot - Building an Outlook-Like Calendar Component for ASP.NET

Rate me:
Please Sign up or sign in to vote.
4.86/5 (120 votes)
8 May 2016Apache5 min read 474.2K   9K   391  
A good-looking ASP.NET control that shows events visually arranged in a day calendar. Includes design-time support and data binding.
using System;
using DayPilot.Web.Ui;
using DayPilot.Web.Ui.Enums;
using DayPilot.Web.Ui.Events;

public partial class Events : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
    }

    protected void DayPilotCalendar1_TimeRangeSelected(object sender, TimeRangeSelectedEventArgs e)
    {
        Label1.Text = "Time cell starting at " + e.Start + " clicked.";
    }
    
    protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
    {
        switch (DropDownList1.SelectedValue)
        {
            case "client":
                DayPilotCalendar1.TimeRangeSelectedHandling = TimeRangeSelectedHandling.JavaScript;
                DayPilotCalendar1.EventClickHandling = EventClickHandlingEnum.JavaScript;
                break;
            case "server":
                DayPilotCalendar1.TimeRangeSelectedHandling = TimeRangeSelectedHandling.PostBack;
                DayPilotCalendar1.EventClickHandling = EventClickHandlingEnum.PostBack;
                break;
            case "disabled":
                DayPilotCalendar1.TimeRangeSelectedHandling = TimeRangeSelectedHandling.Disabled;
                DayPilotCalendar1.EventClickHandling = EventClickHandlingEnum.Disabled;
                break;
        }
    }
    protected void DayPilotCalendar1_EventClick(object sender, EventClickEventArgs e)
    {
        Label1.Text = "Event with ID " + e.Value + " clicked.";
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Apache License, Version 2.0


Written By
Czech Republic Czech Republic
My open-source event calendar/scheduling web UI components:

DayPilot for JavaScript, Angular, React and Vue

Comments and Discussions