Click here to Skip to main content
Click here to Skip to main content

Using DayPilot 2 (Outlook-Like Calendar/Scheduling Control for ASP.NET)

By , 2 Apr 2013
 

Day view screenshot

Sample Image

Week view screenshot

Features 

DayPilot is an Outlook-like open-source event calendar/scheduling control:

  • Simple and clean look.
  • Views:
  • Customizable fonts and colors.
  • Clicking an event can run one of the following:
    • a custom JavaScript action
    • a server-side event (using PostBack)
  • Clicking a free-time slot can run one of the following
    • a custom JavaScript action
    • a server-side event (using PostBack)
  • Flexible data binding:
  • Supports ViewState.
  • Supports both 12-hour (3 PM) and 24-hour (15:00) time format for hour names.
  • Visual Studio 2005 design-time support.
  • Browsers:
    • Internet Explorer 5/5.5/6/7/8/9 
    • Firefox 2+ 
    • Safari 
    • Opera 
    • Chrome  
  • Supports concurrent events.
  • Supports events that end another day.
  • Support for business hours. Supported modes:
    • All day always visible.
    • Only business hours visible.
    • Business hours extended to show all events.

Getting started 

The only required step to make DayPilot working is to bind it to a data source. It supports DataTable (and DataSet) as a data source so you can easily supply the data from your database.

Let's have a following table:

ID  Name Start End
1 Lunch 2012-06-01 12:00:00  2012-06-01 12:30:00
2 Dinner 2012-06-01 19:00:00  2012-06-01 21:00:00 
Sleep 2012-06-01 22:00:00 2012-06-02 07:00:00
4 Breakfest  2012-06-02 07:30:00 2012-06-02 08:30:00

In order to show the events in DayPilot calendar you have to do the following steps:

  1. Place the DayPilot control on a WebForm.
  2. Set the DataSource property.
  3. Set column name properties.
  4. Select the days that will be shown.
  5. Call DataBind(). 

Setting the DataSource property

After loading a DataTable from a database (or other source) you should assign it to the DayPilotCalendar.DataSource property:

DayPilotCalendar1.DataSource = MyDataTable;

In our example we are building the DataTable by hand:

DataTable dt;
dt= new DataTable();
dt.Columns.Add("start", typeof(DateTime));
dt.Columns.Add("end", typeof(DateTime));
dt.Columns.Add("name", typeof(string));
dt.Columns.Add("id", typeof(string));
    
DataRow dr;

dr = dt.NewRow();
dr["id"] = 0;
dr["start"] = Convert.ToDateTime("15:30").AddDays(1);
dr["end"] = Convert.ToDateTime("16:30").AddDays(1);
dr["name"] = "Partner conf. call";
dt.Rows.Add(dr);

// ...

return dt;

When loading the events from a database I recommend limiting the SELECT so only the necessary events are loaded (not all events from the table). DayPilot will work properly in both cases (it only select the relevant events) but all the events will have to be loaded and they will be stored in the ViewState.

Setting column name properties

You need to indicate which columns contain the necessary data:

DayPilotCalendar1.DataStartField = "Start";
DayPilotCalendar1.DataEndField = "End";
DayPilotCalendar1.DataTextField = "Name";
DayPilotCalendar1.DataValueField = "ID";

Setting the visible dates

Let's say we want to show just a single day:

DayPilotCalendar1.StartDate = Convert.ToDateTime("1 June 2012"); 
DayPilotCalendar1.Days = 1; // default (not necessary) 

But we can show multiple days as well. This is a new feature of DayPilot 2.0.

DayPilotCalendar1.StartDate = Convert.ToDateTime("1 June 2012"); 
DayPilotCalendar1.Days = 5;

Example:

Data binding 

Bind the data in the Page_Load() method:

if (!IsPostBack)
    DataBind(); 

Data-related properties overview

Here are the data-related properties of DayPilotCalendar:

Property  Description Type Default value
 DataSource  Source of event data. DataSource or DataTable null
DataStartField Name of the data source column that contains the event start date and time. string null
DataEndField Name of the data source column that contains the event end date and time. string null
DataTextField Name of the data source column that contains the event name. string null
DataValueField Name of the data source column that contains the event ID. The Id will be passed to the event handling code when clicking on the event. string null
StartDate  The first date that should be shown by the calendar. DateTime DateTime.Today
Days The number of days that should be rendered. integer 1

Integration with System.Web.UI.WebControls.Calendar

For switching the date you can use the standard .NET Framework control System.Web.UI.WebControls.Calendar. You can use the PostBack event to change the DayPilot StartDate and EndDate.

In our sample we will use the DayRender event to improve the calendar: 

  • the days will become links to a specific day (i.e. no PostBack)
  • the days that contain an event will be bold
private void Calendar1_DayRender(object sender, System.Web.UI.WebControls.DayRenderEventArgs e)
{
    string fontWeight = "normal";
    if (isThereEvent(e.Day.Date))
        fontWeight = "bold";

    string color = "black";
    if (e.Day.IsOtherMonth)
        color = this.Calendar1.OtherMonthDayStyle.ForeColor.Name;

    e.Cell.Text = String.Format("<a href="/KB/aspnet/Default.aspx"?day={0:d}' style='color: " 
        + color + ";text-decoration:none; font-weight:" 
        + fontWeight + "'>{1}</a>", e.Day.Date, e.Day.Date.Day);        
}

The method isThereEvent() returns true if a specific day contains any event. This method will be specific to your application. You can go through the data returned from the database (and supplied to DayPilotCalendar.DataSource) to avoid another database request. We are not using the database in our sample so it is hard-coded:

private bool isThereEvent(DateTime date)
{
    DateTime today = DateTime.Now;
    DateTime tomorrow = today.AddDays(1);
    DateTime anotherDay = today.AddDays(3);

    // there are events today
    if ((date.DayOfYear == today.DayOfYear) && (date.Year == today.Year))
        return true;

    // there are events tomorrow
    if ((date.DayOfYear == tomorrow.DayOfYear) && (date.Year == tomorrow.Year))
        return true;

    // there are events on another day
    if ((date.DayOfYear == anotherDay.DayOfYear) && (date.Year == anotherDay.Year))
        return true;

    return false;
}

Integration using UpdatePanel

Since version 2.3 DayPilot can be used inside UpdatePanel (ASP.NET AJAX Extensions/.NET Framework 3.5). If you place both the Calendar (System.Web.UI.WebControls.Calendar) and DayPilotCalendar inside the same UpdatePanel you can switch the date using Calendar.SelectionChanged event handler. It can be used like a regular PostBack event:

    protected void Calendar1_SelectionChanged(object sender, EventArgs e)
    {
        DayPilotCalendar1.StartDate = Calendar1.SelectedDate;
        DayPilotCalendar1.DataBind();
    } 

Changing the appearance

There are many options to change the default appearance:

Property Description Type Default value
CellHeight  Cell height in pixels. Minimum is 15.  int 20 
HourWidth  Width of the hour name in pixels. int 40
BusinessBeginsHour  Hour when the business hours start. int 9
BusinessEndsHour  Hour when the business hours end. int 18
HeightSpec  Determines the visible hour range (all or business hours).  HeightSpecEnum  BusinessHoursNoScroll 
ShowHours  Determines whether the hour names column should be visible.  bool  true
TimeFormat  The time format - 12-hours cycle (3 PM) or 24-hours cycle (15:00). TimeFormat Clock24Hours
Width Width of the control. Can be in pixels or in percent (like <table> width attribute). string "100%"

Appearance examples

Default appearance

24 hours

2 days, 12-hours time format

Working week

Handling user actions

There are two types of user actions:

  • clicking a free time (you will typically use this action to create a new event)
  • clicking an event (you will typically use this action to show event details)

The actions can be handled on the client (by custom JavaScript code) or on the server (by handling the server event).

Property Description Type Default value
EventClickHandling Handling of a click on a calendar event (Disabled, JavaScript, or PostBack). EventClickHandlingEnum  Disabled 
TimeRangeSelectedHandling Handling of a click on a free-time slot  (Disabled, JavaScript, or PostBack)  .  TimeRangeSelectedHandling  Disabled 
EventClickJavaScript  JavaScript code that should be executed when the user clicks on a calendar event (provided that EventClickHandling is set to JavaScript). The string "{0}" will be replaced with an event ID. string "alert('{0}');"
TimeRangeSelectedJavaScript  JavaScript code that should be executed when the user clicks on a free-time slot (provided that FreetimeClickHandling is set to JavaScript). The string "{0}" will be replaced with the date and time specified in the standard format produced by DateTime.ToString("s") - e.g. "2006-05-15T07:00:00".  string "alert('{0}');"

Server-side event handling 

Event  Description 
EventClick  Occurs when the user clicks on an event and EventClickHandling property is set to PostBack. 
TimeRangeSelected  Occurs when the user clicks on an event and TimeRangeSelectedHandling property is set to PostBack. 

Your server-side event handling methods will get the important data:

EventClick knows the primary key (PK column)

private void DayPilotCalendar1_EventClick(object sender, EventClickEventArgs e)
{
    Label1.Text = "Selected event: " + e.Value;
}

FreeTimeClick knows the time clicked

private void DayPilotCalendar1_TimeRangeSelected(object sender, TimeRangeSelectedEventArgs e)
{
    Label1.Text = "Selected time: " + e.Start;
}

Resources

History

License

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

About the Author

Dan Letecky
Czech Republic Czech Republic
Member
My open-source AJAX controls:
 
DayPilot
DayPilot MVC
DayPilot Java
Outlook-Like Calendar/Scheduling Controls

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board.
Search this forum  
    Spacing  Noise  Layout  Per page   
GeneralMy vote of 5memberSavalia Manoj M21 Jan '13 - 22:19 
good work...!!
GeneralRe: My vote of 5memberDan Letecky2 Apr '13 - 4:21 
Thanks!
--
My open-source AJAX controls:
DayPilot - Calendar/Scheduling Control for ASP.NET WebForms
DayPilot for MVC - Calendar/Scheduling Control for ASP.NET MVC
DayPilot for Java - Calendar/Scheduling Control for Java

GeneralMy vote of 5memberamitgajjar11 Jun '12 - 20:10 
good one... i will defiantly try it in my application.
GeneralRe: My vote of 5memberDan Letecky11 Jun '12 - 21:47 
Thanks!
--
My open-source ASP.NET 2.0 controls:
DayPilot - Outlook-like calendar/scheduling control
DayPilot MonthPicker - Light-weight month picker
MenuPilot - Hover context menu

GeneralMy vote of 5membersantosh poojari11 Jun '12 - 17:15 
Excellent
GeneralRe: My vote of 5memberDan Letecky11 Jun '12 - 21:47 
Thanks!
--
My open-source ASP.NET 2.0 controls:
DayPilot - Outlook-like calendar/scheduling control
DayPilot MonthPicker - Light-weight month picker
MenuPilot - Hover context menu

GeneralMy vote of 5membermanoj kumar choubey16 Feb '12 - 0:43 
Nice
GeneralRe: My vote of 5memberDan Letecky11 Jun '12 - 21:47 
Thanks!
--
My open-source ASP.NET 2.0 controls:
DayPilot - Outlook-like calendar/scheduling control
DayPilot MonthPicker - Light-weight month picker
MenuPilot - Hover context menu

NewsSource code available onlinememberGilad Khen30 May '09 - 16:40 
Here[^]
GeneralEnable a Specific cell as a Free Time and Disable other cells who are notmemberHassan Akhtar Ali16 Nov '08 - 19:41 
Hello hope u all having a good time, well
i have a sinceario of implementing a webschedular
the requirment is i have 3 tables
 
Tutor Working hours(Master)
PK_ID TutorID CourseID StartingDateID
 
This is table is meant by
A teacher can teach a course on a specific starting date marked by the univ
 
DetailTutorWorking Hours (Detail)
PK_ID FK_ID(PK_ID) StartTime EndTime DayofWeek
This is the detail table where a tutor can mark its free working hourse now like if i can say :
 
David(TutorID) teaches CCNA(COurseID) that starts on 3 Nov(StartingDateID)
and he marks his available time on 12:00pm(start time) to 1:00pm(end time) on monday and tuesday
 
now within this interval the student is available and can mark his appointment if the working hour is free he can save his appointment, if it is taken by some one else it is un editable, if it is already his saved then he can edit it, please suggest me what can i do to achieve this, please help me saving my job as i m in very much big depression now days i shall be very very gratefull to you,, regards
 
Hassan Akhtar

GeneralAwesomemembermerlin98119 May '08 - 11:49 
This is great! Thank you very much. 5 from me
 


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Rhabot - World of Warcraft Bot
Uber RPGE - Free Private World of Warcraft Server
Make long URLs short with NeatURL.net
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

QuestionEvent spanning on more than a day ?membercardigait6 Jun '07 - 3:43 
Wonderful product and thinking to pick the pro solution.
I'm thinking to insert the events in other existing pages (with recurring events and so on) and to use it for the superb visaulization.
I just can't see any sample of events spanning on more than a day, maybe [hope] acting like outlook do ?
 
Any detail or link to sample given is appreciated,
Fabrizio
AnswerRe: Event spanning on more than a day ?memberDan Letecky6 Jun '07 - 3:56 
Thanks. Wink | ;-)
 
The events longer than a day are shown as "event parts" in each day. E.g. event lasting from Thursday 20:00 to Saturday 05:00 will have three pieces: Thursday 20:00 - Thursday 24:00, Friday 00:00 - Friday 24:00, and Saturday 00:00 - 05:00. See "Event 6" on this sample page: http://www.daypilot.org/demo/Horizontal/.
 
Outlook shows such events in the "All day events" area on the top of the calendar and marks the duration using a blue line on the left side of a day column. DayPilot is making such event more visible.
 
It's always possible to discuss the features on the roadmap - contact me at daypilot @ annpoint.com if you have any specific requirements Wink | ;-) .
 

 
--
My open-source ASP.NET 2.0 controls:
DayPilot - Outlook-like calendar/scheduling control
MenuPilot - Hover context menu

QuestionJust reviewed the daypilotmemberambshah4 May '07 - 3:32 
hi Dan
great component i was just reviewing the code and the workings
 
Some suggestions
1) when we have non business hours it becomes really long
maybe a two hour box would help shorten it
2) i use a seven day at a glance view
from selected date -3 to seven days ahead
maybe an option to highlight a particular date (informing the user which date he has selected)
 
Thanks again for your efforts on this control.
viva la opensource!
 
http://www.chowknews.com
AnswerRe: Just reviewed the daypilotmemberDan Letecky11 May '07 - 4:21 
Hi,
 
Thanks for the nice ideas! I will consider them for the next release.
 
--
My open-source ASP.NET 2.0 controls:
DayPilot - Outlook-like calendar/scheduling control
MenuPilot - Hover context menu

QuestionDates on X Axis and Tasks on Y Axismemberrk3320 Jan '07 - 9:12 
This is great.
But what i was looking is just the dates for tasks and not time....
At this point due to overlapping days every event overlaps on the calendar making it unreadable.
Basically, along the Y Axis i would like to see the event wise grouping as opposed to time..
Is that Possible?
Can u plz help btw I am using ASP.NET 1.1
AnswerRe: Dates on X Axis and Tasks on Y AxismemberDan Letecky19 Mar '07 - 3:08 
Yes, that would be useful but it would also mean writing a completely new control Smile | :) .

 
--
My sites for smart .NET developers:
DayPilot - Open-source Outlook-like calendar control for ASP.NET
DotLucene - The fastest open source fulltext search engine for .NET
MenuPilot - Open-source task menu for ASP.NET 2.0
Seekafile Server - Flexible open-source search server
DotNetFirebird

GeneralRe: Dates on X Axis and Tasks on Y AxismemberDan Letecky7 Aug '07 - 21:34 
This is now possible with DayPilotVertical and DayPilotScheduler controls. But these are only available in the commercial version of DayPilot.
 
--
My open-source ASP.NET 2.0 controls:
DayPilot - Outlook-like calendar/scheduling control
MenuPilot - Hover context menu

GeneralA simple change to make free time freely available...memberForogar4 Jan '07 - 12:08 
Clicking on free time entirely covered by an event doesn't seem to be currently possible.
In Outlook there is a thin gap at the right of each event box where is it possible to get at the time slot behind the event. This can be achieved with the following one-line code change in the renderEvent method (within DayPilotCalendar.cs) where it has the line:
 
divMain.AddStyleAttribute("width", e.Column.WidthPct + "%");
 
...replace this with the following:
 
divMain.AddStyleAttribute("width", (e.Column.WidthPct - 3) + "%");
 
...and you will have a small gap to the right of each event box big enough to click in to select a free time.
 
You may want to use -2 or -4 instead of -3 but I think that gives the best gap balanced for real-estate usage versus click-ability - and looks about the same as the gap in my version of Outlook.

 
Life in the fast lane is only fun if you live in a country with no speed limits.

GeneralRe: A simple change to make free time freely available...memberDan Letecky19 Mar '07 - 3:01 
Thanks for a good tip!
 
--
My sites for smart .NET developers:
DayPilot - Open-source Outlook-like calendar control for ASP.NET
DotLucene - The fastest open source fulltext search engine for .NET
MenuPilot - Open-source task menu for ASP.NET 2.0
Seekafile Server - Flexible open-source search server
DotNetFirebird

QuestionEvents not showingmembermaryg1293 Jan '07 - 11:48 
Hi I followed the 5 steps in the databinding portion of the tutorial on daypilot.org and my events don't appear. I used Visual Web Developer to set data related properties and bind on page_load.Here's my code, do I need additional code to show the events? Thanks.
 
<%@ Page Language="VB" %>
 
<%@ Register Assembly="DayPilot" Namespace="DayPilot.Web.Ui" TagPrefix="DayPilot" %>
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
<script runat="server">
 
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
If IsPostBack Then
DataBind()
End If
 
End Sub

</script>
 
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>FRC Calendar</title>
</head>
<body>
<form id="form1" runat="server">
<daypilot:daypilotcalendar id="Calendar1" runat="server" backcolor="#FFFFD5"
bordercolor="Black" dataendfield="edate" datasourceid="FRCCalendar" datastartfield="sdate"
datatextfield="EDescr" datavaluefield="Eventid" dayfontfamily="Tahoma" dayfontsize="10pt"
days="3" eventbackcolor="White" eventbordercolor="Black" eventfontfamily="Tahoma"
eventfontsize="8pt" eventhovercolor="Gainsboro" eventleftbarcolor="Blue" hourbordercolor="#EAD098"
hourfontfamily="Tahoma" hourfontsize="16pt" hourhalfbordercolor="#F3E4B1" hournamebackcolor="#ECE9D8"
hournamebordercolor="#ACA899" hovercolor="#FFED95" nonbusinessbackcolor="#FFF4BC"
startdate="2007-01-03" style="position: static">
<asp:AccessDataSource ID="FRCCalendar" runat="server" DataFile="~/App_Data/frccalendar.mdb"
SelectCommand="SELECT [Eventid], [sdate], [edate], [stime], [etime], [CategoryID], [EDescr] FROM [qryeventdump] ORDER BY [sdate]">


</form>
</body>
</html>

 
MaryFRC

AnswerRe: Events not showingmemberDan Letecky19 Mar '07 - 3:01 
If there are no events visible you should check whether DayPilotCalendar.StartDate is set to the right date. Check if there are any events returned for 2007-01-03 (see your code) by your select command.
 
Moreover, I recommend limiting the number of events in the SELECT command to only the relevant ones (i.e. visible on the calendar). DayPilot will still work correctly but there will be too much stuff in ViewState and it can become slow.
 
--
My sites for smart .NET developers:
DayPilot - Open-source Outlook-like calendar control for ASP.NET
DotLucene - The fastest open source fulltext search engine for .NET
MenuPilot - Open-source task menu for ASP.NET 2.0
Seekafile Server - Flexible open-source search server
DotNetFirebird

QuestionLoad event based on Date selection , Need HelpmemberDeepak_DOTNET26 Nov '06 - 22:58 
Hi
i am using DayPilot 2.0.1 (.NET Framework 1.1) ,bcoz i cann't use .NET 2.0 in my server right now.
 
When user change the date using .NET calender,the events corresponding to the selected date should be loaded in outlook
calender(DayPilot control).But that is not happening.i have given all code which i have put in page.IF any thing missing me
please guide me.l what code i need to write to achieve it .plz tell me how to load events of selected date selected by user.if no event is there
for selected date,let it show nothing in outlook calender(DayPilot control).How to achieve it..?
 
and also how do these events beneficial to users :
clicking a free time
clicking an event
 
a) When i click on any free time column,a pop message box with date and time will be showed.
-- is it possible to add new event in free time sections from user interface(not from database)...?
b) when i click on any existing event , a pop message box with event id will displayed.
-- is it possible to show the all Event details ("name","start","End" columns values) in small pop up window (instead of pop up message box with event id) ...?
-- i want to open a ssmall window instead of pop up message box.
please help regarding this.
 
Thank U
Deepak
 

 
CODE i have used as below :
 
table : "tblCalender"
 
ID Name start End
 
1 BreakFast 11/20/2006 9:00 AM 11/20/2006 9.30 AM
2 Lunch 11/20/2006 1:00 PM 11/20/2006 1:30 PM
3 Dinner 11/20/2006 9:00 PM 11/20/2006 9:30 PM
 

<DayPilot:DayPilotCalendar id="DayPilotCalendar1" runat="server" EndColumnName="end" NameColumnName="Name"
BeginColumnName="start" PkColumnName="ID" TimeFormat="Clock12Hours" EndDate="2006-11-24"
StartDate="2006-11-20">
 
Private Sub CalenderDataBind()
Dim calenderTable As New DataTable
Dim sqlQry As String = "SELECT * FROM tblCalender"
Dim conStr As String = System.Configuration.ConfigurationSettings.AppSettings.Get("supportDB")
Dim sqlAdp As New SqlClient.SqlDataAdapter(sqlQry, conStr)
sqlAdp.Fill(calenderTable)
DayPilotCalendar1.DataSource = calenderTable
DayPilotCalendar1.DataBind()
End Sub
 
i have .NET calender control
 
<asp:Calendar id="Calendar1" style="Z-INDEX: 101; LEFT: 448px; POSITION: absolute; TOP: 16px"
runat="server">
 
IT is very urgent,plz give me soultion
QuestionLoad event based on Date selection , Need HelpmemberDeepak_DOTNET26 Nov '06 - 22:58 
Hi
i am using DayPilot 2.0.1 (.NET Framework 1.1) ,bcoz i cann't use .NET 2.0 in my server right now.
 
When user change the date using .NET calender,the events corresponding to the selected date should be loaded in outlook
calender(DayPilot control).But that is not happening.i have given all code which i have put in page.IF any thing missing me
please guide me.l what code i need to write to achieve it .plz tell me how to load events of selected date selected by user.if no event is there
for selected date,let it show nothing in outlook calender(DayPilot control).How to achieve it..?
 
and also how do these events beneficial to users :
clicking a free time
clicking an event
 
a) When i click on any free time column,a pop message box with date and time will be showed.
-- is it possible to add new event in free time sections from user interface(not from database)...?
b) when i click on any existing event , a pop message box with event id will displayed.
-- is it possible to show the all Event details ("name","start","End" columns values) in small pop up window (instead of pop up message box with event id) ...?
-- i want to open a ssmall window instead of pop up message box.
please help regarding this.
 
Thank U
Deepak
deepak.ramaiah@vertscape.net
 

CODE i have used as below :
 
table : "tblCalender"
 
ID Name start End
 
1 BreakFast 11/20/2006 9:00 AM 11/20/2006 9.30 AM
2 Lunch 11/20/2006 1:00 PM 11/20/2006 1:30 PM
3 Dinner 11/20/2006 9:00 PM 11/20/2006 9:30 PM
 

<DayPilot:DayPilotCalendar id="DayPilotCalendar1" runat="server" EndColumnName="end" NameColumnName="Name"
BeginColumnName="start" PkColumnName="ID" TimeFormat="Clock12Hours" EndDate="2006-11-24"
StartDate="2006-11-20">
 
Private Sub CalenderDataBind()
Dim calenderTable As New DataTable
Dim sqlQry As String = "SELECT * FROM tblCalender"
Dim conStr As String = System.Configuration.ConfigurationSettings.AppSettings.Get("supportDB")
Dim sqlAdp As New SqlClient.SqlDataAdapter(sqlQry, conStr)
sqlAdp.Fill(calenderTable)
DayPilotCalendar1.DataSource = calenderTable
DayPilotCalendar1.DataBind()
End Sub
 
i have .NET calender control
 
<asp:Calendar id="Calendar1" style="Z-INDEX: 101; LEFT: 448px; POSITION: absolute; TOP: 16px"
runat="server">
 
IT is very urgent,plz give me soultion
AnswerRe: Load event based on Date selection , Need Helpmemberlangdaddy28 Jan '07 - 13:32 
To have the DayPilot change for the date
 

protected void Calendar1_SelectionChanged(object sender, EventArgs e)
{
DayPilotCalendar1.StartDate = Calendar1.SelectedDate;
}

 
Keith L Lang
GeneralImplement isThereEvent Methodmemberobinna_eke9 Oct '06 - 3:46 
How do you implement the method isThereEvent, I have implemented the getData pls help
 
private bool isThereEvent(DateTime date)
{
//help me pls
}
 

protected DataTable getData
{
get
{
DataTable dt;
dt = new DataTable();
dt.Columns.Add("start", typeof(DateTime));
dt.Columns.Add("end", typeof(DateTime));
dt.Columns.Add("name", typeof(string));
dt.Columns.Add("id", typeof(string));
DataRow dr;
DateTime myDate;
string myStrDate = Request.QueryString["day"].ToString();
myDate = Convert.ToDateTime(myStrDate);
 
Response.Write("
Well we have " + myStrDate);

SqlConnection myConnection = new SqlConnection();
myConnection.ConnectionString = "Data Source=SQL01;Initial Catalog=POMACS;Integrated Security=True";
SqlCommand myCommand = new SqlCommand();
 
myCommand.Parameters.Add(new SqlParameter("@startDate", SqlDbType.NVarChar,41));
myCommand.Parameters.Add(new SqlParameter("@endDate", SqlDbType.NVarChar,40));
myCommand.Parameters["@startDate"].Value = myStrDate;
myCommand.Parameters["@EndDate"].Value = myStrDate;
myCommand.CommandType = CommandType.StoredProcedure;
myCommand.CommandText = "MyDumbProc";
myConnection.Open();
myCommand.Connection = myConnection;
 
SqlDataReader myReader = myCommand.ExecuteReader();
try
{
while (myReader.Read())
{
dr = dt.NewRow();
Response.Write("
Start " + myReader["starttime"].ToString());
Response.Write(" End " + myReader["endtime"].ToString());
Response.Write(" Sub " + myReader["subject"].ToString());
 
dr["start"] = Convert.ToDateTime(myReader["starttime"].ToString());
dr["end"] = Convert.ToDateTime(myReader["endtime"].ToString());
dr["name"] = myReader["subject"].ToString();
dt.Rows.Add(dr);
}
}
catch (System.Exception ex)
{
Response.Write(ex.ToString());
}
finally
{
myReader.Close();
myConnection.Close();
}
return dt;
 
}
 
}
GeneralRe: Implement isThereEvent MethodmemberDan Letecky19 Mar '07 - 3:04 
This is what I have in the sample:
 
private bool isThereEvent(DateTime date)
{
DateTime today = DateTime.Now;
DateTime tomorrow = today.AddDays(1);
DateTime anotherDay = today.AddDays(3);
 
// there are events today
if ((date.DayOfYear == today.DayOfYear) && (date.Year == today.Year))
return true;
 
// there are events tomorrow
if ((date.DayOfYear == tomorrow.DayOfYear) && (date.Year == tomorrow.Year))
return true;
 
// there are events on another day
if ((date.DayOfYear == anotherDay.DayOfYear) && (date.Year == anotherDay.Year))
return true;
 
return false;
}
 

But it's just a quick and dirty solution for my case. You will typically want to load the data from a database (just event counts for each day) and check all the days against this list.
 
--
My sites for smart .NET developers:
DayPilot - Open-source Outlook-like calendar control for ASP.NET
DotLucene - The fastest open source fulltext search engine for .NET
MenuPilot - Open-source task menu for ASP.NET 2.0
Seekafile Server - Flexible open-source search server
DotNetFirebird

GeneralRe: Implement isThereEvent MethodmemberDan Letecky7 Aug '07 - 21:30 
Check also this forum thread for a hint on implementing isThereEvent:
 
http://forums.daypilot.org/Topic.aspx/110/modify_isthereevent_method
 

 
--
My open-source ASP.NET 2.0 controls:
DayPilot - Outlook-like calendar/scheduling control
MenuPilot - Hover context menu

GeneralInteresting..memberSpotnick4 Jul '06 - 8:22 
It's so easy to use it makes me jealous I didn't think of this when I developped mine.
 
It would be nice to have a simple feature to configure the colors though, just a suggestion.
 
Are you planning to do a monthview like Outlook someday? This is actually the one I did.
 
I will start to play with this one, I hope I'll be able to add small images before tasks and to give a task a color, I guess I'll need to override a few things to do that, but that should be fine. "All day events" would be a really nice addition like other said before.
 
Congrats!
GeneralRe: Interesting..memberwardeaux20 Jul '06 - 6:40 
I would also be interested in the Event/task coloring (assign color to event/task background), all day events, and "Monthview"... any hope of this in the NEAR future?
GeneralRe: Interesting..memberDan Letecky19 Mar '07 - 3:07 
I'm now offering an advanced version of DayPilot for money - it's called DayPilot Pro and it has features like this one.
 
Check here: http://www.daypilot.org/daypilot-pro.html
 
--
My sites for smart .NET developers:
DayPilot - Open-source Outlook-like calendar control for ASP.NET
DotLucene - The fastest open source fulltext search engine for .NET
MenuPilot - Open-source task menu for ASP.NET 2.0
Seekafile Server - Flexible open-source search server
DotNetFirebird

GeneralDayPilot 2.0.1 releasedmemberDan Letecky23 Jun '06 - 3:00 
This is a bugfix release. Read more in the release notes.
 
You can go directly to the download.
 
--
My sites for smart .NET developers:
DayPilot - Open-source Outlook-like calendar control for ASP.NET
DotLucene - The fastest open source fulltext search engine for .NET
Seekafile Server - Flexible open-source search server
DotNetFirebird - Using Firebird SQL in .NET

GeneralFrom Almost 1 To 5memberBassam Abdul-Baki13 Jun '06 - 3:11 
I was almost ready to give up on this since I couldn't get it to work out of the box. Actually, this is the only application of yours that I got to work. The index server search engine wouldn't work no matter what I tried. For this one, I realized I had to change the ASP .NET version in IIS from 1.4 to 2.0, and that finally got it to work. Didn't read the article to see if it was mentioned. Blush | :O Great job. One request, will you be adding a way to add daily, weekly or any repeating events? Also, all day events need to appear at the top. If you could add that functionality it would be great.
 

There are II kinds of people in the world, those who understand binary and those who understand Roman numerals. Web - Blog - RSS - Math
GeneralDayPilot 2.0 releasedmemberDan Letecky9 Jun '06 - 12:55 
What's new since 1.1:
 
- Multiple days can appear in one control
- Supports day headers (see new properties ShowHeader, HeaderHeight and HeaderDateFormat)
- API Change: Property "Date" is now replaced by "StartDate" and "EndDate"
- Hour height is now reducible down to 30 pixels without additional tweaking
 
Read more in the release notes.
 
--
My sites for smart .NET developers:
DayPilot - Open-source Outlook-like calendar control for ASP.NET
DotLucene - The fastest open source fulltext search engine for .NET
Seekafile Server - Flexible open-source search server
DotNetFirebird - Using Firebird SQL in .NET

QuestionRepeating events?memberJP Hinkle29 May '06 - 10:33 
Beautiful work! I have one question though. How would one represent repeating events? So far I've been thinking of creating a separate table to keep track of the events that are repeating and then feeding the main calendar table from that, however I'm not sure if this is the most efficient way of doing this. Any ideas?
 
-JP
AnswerRe: Repeating events?memberDan Letecky9 Jun '06 - 12:57 
The control is designed to show exactly what you supply. So the repeating events must already in the DataTable as separate events.
 
--
My sites for smart .NET developers:
DayPilot - Open-source Outlook-like calendar control for ASP.NET
DotLucene - The fastest open source fulltext search engine for .NET
Seekafile Server - Flexible open-source search server
DotNetFirebird - Using Firebird SQL in .NET

GeneralDay/Date HeadermemberfatChurchill26 May '06 - 9:56 
Great, great control! I loved it so much I whipped together an acsx that included DayPilot and a matching header (in vb.net). I'd be glad to convert it/create a DayPilotHeader class in C# if you need it.
 
regards,Ken Tilley
GeneralRe: Day/Date HeadermemberDan Letecky27 May '06 - 7:36 
I'm glad that you like it Wink | ;-)
 
I'm planning to the header directly into the control. But I will be glad if you send me your ascx - I'd like to make it available for the users before the header is built in.
 
--
My sites for smart .NET developers:
DayPilot - Open-source Outlook-like calendar control for ASP.NET
DotLucene - The fastest open source fulltext search engine for .NET
Seekafile Server - Flexible open-source search server
DotNetFirebird - Using Firebird SQL in .NET

GeneralNice !!!!memberVarindir Rajesh Mahdihar24 May '06 - 6:14 
excellent work, something truely useful for an application.
 
thanks for sharing
GeneralRe: Nice !!!!memberDan Letecky27 May '06 - 7:34 
Thanks Wink | ;-)
 
--
My sites for smart .NET developers:
DayPilot - Open-source Outlook-like calendar control for ASP.NET
DotLucene - The fastest open source fulltext search engine for .NET
Seekafile Server - Flexible open-source search server
DotNetFirebird - Using Firebird SQL in .NET

NewsCalendarmemberMihai Maerean23 May '06 - 20:37 
Have you seen the new Google Calendar http://www.google.com/calendar/ ?
 
It's very interactive (uses AJAX a lot) and you can even drag&drop the events around.
 


@};- Let there be love @};-

Kilroy was here
GeneralRe: CalendarmemberDan Letecky24 May '06 - 5:13 
One day DayPilot should have similar AJAX features. Just give me some time ... Wink | ;-)
 
--
My sites for smart .NET developers:
DayPilot - Open-source Outlook-like calendar control for ASP.NET
DotLucene - The fastest open source fulltext search engine for .NET
Seekafile Server - Flexible open-source search server
DotNetFirebird - Using Firebird SQL in .NET

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Permalink | Advertise | Privacy | Mobile
Web03 | 2.6.130516.1 | Last Updated 2 Apr 2013
Article Copyright 2006 by Dan Letecky
Everything else Copyright © CodeProject, 1999-2013
Terms of Use
Layout: fixed | fluid