search envelope-o feed check
Home Unanswered Active Tags New Question
user comment-o

Event handling

Asked by Paliox ICT09
17 years ago.
protected void calPlanner_EventClick(string pk)
{
MessageBox.Show("This is a test");
}

Doesn't work, the default popup is shown whith the id of the meeting
(i actually use a messagebox class in c#.net)
Comment posted by Dan Letecky
17 years ago.
1. You must set EventClickHandling property to UserActionHandling.PostBack. Otherwise it calls the JavaScript defined in JavaScriptEventAction property.

See the tutorial: http://www.daypilot.org/handling-user-actions.html

See also the source code of Event handling demo (available in the download package) - http://www.daypilot.org/demo/Events.aspx

2. If you mean the same MessageBox.Show() as I do, it's not available in ASP.NET (only Windows Forms).
Comment posted by Anonymous
16 years ago.
Hey

i actually have the same problem.
i'm using the free version and when i put the eventClickHandling property to Postback, it does do a postback (so no more javascript) but it does not execute my code written in
protected void DayPilotCalendar1_EventClick(string pk)
{
//stuff i want to do
}
he just does not enter this methode, since i toggled a breakpoint and he never stops there

anything you can advise me to try?
Comment posted by Dan Letecky
16 years ago.
OK, I've tried it myself with DayPilot 2.1 SP3 to make sure that everything works.

It seems that you are missing OnEventClick property in .aspx. This is how the source should look:

<daypilot:daypilotcalendar id="DayPilotCalendar1" runat="server"
FreetimeClickHandling="PostBack"
OnFreetimeClick="DayPilotCalendar1_FreeTimeClick"
EventClickHandling="PostBack"
OnEventClick="DayPilotCalendar1_EventClick"
DataStartField="start"
DataEndField="end"
DataValueField="id"
DataTextField="name">
</daypilot:daypilotcalendar>

Note the bold line. That will be automatically created for you if you double click the EventClick event in the properties editor in the Visual Studio.

Let me know if this solved your problem.
Comment posted by Anonymous
16 years ago.
thanks, works great now :)
i think i just typed the method myself and didnt knew another line had to be added in aspx page..

i must say love your project here.. i just wished Ajax was in the free version as well, i really could use it :p
Comment posted by Gareth Evans
16 years ago.

Tutorial does not explain how to change this.

Comment posted by Gareth Evans
16 years ago.

Sorry i mean still dont work for me:

I have set:

TimeRangeSelectedHandling to: Postback

and

EventClickHandlinf to: Postback

however when i still use the code such as:

protected void DayPilotCalendar1_EventClick(string pk)
{
//stuff i want to do
}

all it does is refreshes the page nothign else....? please help

gareth

Comment posted by Dan Letecky
16 years ago.
Can you send that page (.aspx + .aspx.cs) to daypilot @ annpoint.com? I'll take a look at it.
This question is more than 1 months old and has been closed. Please create a new question if you have anything to add.