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

How to call a DayPilotCalendar event on button click of ASP.NET ?

Asked by Anonymous
2 months ago.

I have a DayPilotCalendar which can create new tasks and can edit them. Now I want to call the same javascript function on a button click event of asp.net. But it is not firing. Is this possible?
For ex: TimeRangeSelectedJavaScript event of DayPilotCalendar is calling the function 'create(start, end, resource);'. And it will popup a modal for creating new task. Now I want to call the same function on button click of aspx like below.

<%@ Register Assembly="DayPilot" Namespace="DayPilot.Web.Ui" TagPrefix="DayPilot" %>
<script src="Scripts/DayPilot/modal.js" type="text/javascript"></script>
<DayPilot:DayPilotCalendar
ID="DayPilotCalendarDay"
runat="server"
ClientObjectName="dp_day"
DataEndField="end_time"
DataStartField="start_time"
DataTextField="task_name"
DataValueField="task_id"
DataRecurrenceField="recurrence"
Theme="timetable_simple"
ViewType="Day"
TimeRangeSelectedHandling="JavaScript"
TimeRangeSelectedJavaScript="create(start, end, resource);"
EventMoveHandling="CallBack"
EventResizeHandling="CallBack"
OnCommand="DayPilotCalendarDay_Command"
EventClickHandling="JavaScript"
EventClickJavaScript="ask(e)"
/>
function create(start, end, resource) {
createModal().showUrl('NewTask.aspx?start=' + start + "&end=" + end + "&resource=" + resource);
}
<asp:LinkButton ID="linkbtn_show" runat="server" Text="Create New Task"
OnClientClick="javascript: create(2021-08-16T13:00:00, 2021-08-16T13:00:00, null);" >
</asp:LinkButton>

Answer posted by Dan Letecky [DayPilot]
2 months ago.

Try this:

<asp:LinkButton ID="linkbtn_show" runat="server" Text="Create New Task"
OnClientClick="javascript: create('2021-08-16T13:00:00', '2021-08-16T13:00:00', null);" >
</asp:LinkButton>
New Reply
This reply is
Your name (optional):