Home Unanswered Active Tags New Question

Day Pilot Scheduler - How can I pass the DataValueField to a javascript function on EventClickJavascript event ?

Hi I currently am using the open source version of the DayPilotScheduler control which I really like, but I am unclear on how I can pass the DataValueField which in my case is called "EventID" through to javascript function. I tried the following :

<DayPilot:DayPilotScheduler ID="DayPilotScheduler2" runat="server" DataStartField="StartDate"
DataTextField="Subject" DataValueField="EventID" DataEndField="EndDate" DataResourceField="StaffID"
BackgroundColour="backgroundColour" Width="100%" Days="1" BusinessBeginsHour="9"
BusinessEndsHour="18" CellDuration="60" CellWidth="69" RowHeaderWidth="157" TimeFormat="Clock12Hours"
Enabled="True" FreeTimeClickHandling="JavaScript" EventClickHandling="JavaScript"
ViewStateMode="Enabled" ShowToolTip="True" EventClickJavaScript="loadEdit('{0}');"
FreeTimeClickJavaScript="loadEdit('{0}');" ondatabinding="DayPilotScheduler2_DataBinding"
/>

but {0} seems to only be the subject. and {1} would be empty.

many thanks .

Asked by Anonymous 6 months ago.
2 other people also want an answer.
Replies

{0} should get replaced with the DataValueField value (EventID in your case). See the following code snippets:

DayPilotScheduler.cs
  string val = DataBinder.GetPropertyValue(dataItem, DataValueField, null);
  // ...
  ((ArrayList)ViewState["Items"]).Add(new Event(val, start, end, name, resourceId));,
Event.cs
        public Event(string pk, DateTime start, DateTime end, string name, string resource)
        {
            this.PK = pk;
            this.Start = start;
            this.End = end;
            this.Name = name;
            this.Resource = resource;
        }
DayPilotScheduler.cs
output.AddAttribute("onclick", "javascript:event.cancelBubble=true;" + String.Format(EventClickJavaScript, p.PK));
Answer posted by Dan Letecky [DayPilot] 5 months ago.
New Reply
This reply is
Your name (optional):

DayPilot for ASP.NET WebForms, DayPilot for ASP.NET MVC, DayPilot for Java