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

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

Asked by Anonymous
13 years ago.

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 .

Answer posted by Dan Letecky [DayPilot]
12 years ago.

{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));
This question is more than 1 months old and has been closed. Please create a new question if you have anything to add.