Hello,
I am trying out DayPilot Lite Version (2.3)
In my aspx.
<DayPilot:DayPilotCalendar ID="testCalendar" runat="server"
DataStartField="Start" DataEndField="End" DataTextField="Text" DataValueField="Value"
/>
In Code-behind.
testCalendar.EventClickHandling = DayPilot.Web.Ui.UserActionHandling.PostBack;
testCalendar.FreetimeClickHandling = DayPilot.Web.Ui.UserActionHandling.PostBack;
testCalendar.FreeTimeClick += new DayPilot.Web.Ui.FreeClickDelegate(testCalendar_FreeTimeClick);
testCalendar.EventClick += new DayPilot.Web.Ui.EventClickDelegate(testCalendar_EventClick);
The click event handler
protected void testCalendar_FreeTimeClick(object sender, DayPilot.Web.Ui.FreeClickEventArgs e)
{
somet code to do...
}
I put a break point within the event handler, and nothing happens.
I even tried using the source code, and I saw this part.
DayPilotCalendar.cs
public void RaisePostBackEvent(string eventArgument)
{
if (eventArgument.StartsWith("PK:"))
{
string pk = eventArgument.Substring(3, eventArgument.Length - 3);
if (EventClick != null)
EventClick(this, new EventClickEventArgs(pk));
}
else if (eventArgument.StartsWith("TIME:"))
{
DateTime time = Convert.ToDateTime(eventArgument.Substring(5, eventArgument.Length - 5));
if (FreeTimeClick != null)
FreeTimeClick(this, new FreeClickEventArgs(time));
}
else
{
throw new ArgumentException("Bad argument passed from postback event.");
}
}
The FreeTimeClick is always null, even though I set the event handler on my code-behind.
I have no idea why this happens. Postback happens properly, but the FreTimeClick event does not happen somehow. The FreeTimeClick event property is always set to null.
Can someone help?
Seung
-
3/28/2008 8:53:56 PM
I would guess you have the event handler assigning code inside if (!IsPostBack) {} block:
if (!IsPostBack) {
// ...
testCalendar.FreeTimeClick += new DayPilot.Web.Ui.FreeClickDelegate
(testCalendar_FreeTimeClick);
// ...
}
You can try moving the code outside of that block or put it into the .aspx file:
<DayPilot:DayPilotCalendar ID="DayPilotCalendar1" runat="server"
...
OnEventClick="testCalendar_EventClick"
OnFreeTimeClick="testCalendar_FreeTimeClick">
</DayPilot:DayPilotCalendar>
Copyright © 2007-2010 Annpoint, s.r.o.