DayPilot Forums

DayPilot is the best open-source Outlook-like calendar control for ASP.NET.
DayPilot Pro Demo (Calendar control)
» DayPilot Pro live demo (Calendar control)
DayPilot Pro Demo (Scheduler control)
» DayPilot Pro live demo (Scheduler control)
Home » How To » Create a new Resource booking in schedule by clicking on schedule date

Create a new Resource booking in schedule by clicking on schedule date

Hi,

I'm trying to setup the facility for a client to book a resource by clicking on specific day for a resource in the scheduler view. I use VB.net, so I'm finding the examples in C#/javascript a little hard to follow.

Do I have to use Javascript to achieve this functionality?

Whats the easiest way to achive this? Using events or javascript?

I've tried http://www.daypilot.org/howto-open-a-popup-window-for-entering-new-event.html but when I click on empty space nothing happens. When I click on an event I get "Microsoft JScritp runtime error: 'start' is undefined"

John - 6/13/2008 2:41:55 PM

Just noticed that I was using "EventClickJavaScript" instead of "TimeRangeSelectedJavaScript" in the schedular code.

So now nothing comes up when I click on an event, but the same "'Start' is undefined" error comes up when I click on an empty cell...

Help!

John - 6/13/2008 2:47:03 PM

News.

I tried using

TimeRangeSelectedHandling= "JavaScript"
TimeRangeSelectedJavaScript = "openPopup(start, end, column);"

and this as per example on site

function openPopup(e)
{
window.open('bookingPopupNew.aspx?start='
+ DayPilot.ds(start)
+ '&end=' + DayPilot.ds(end)
+ '&column=' + column,
'PopupDetail','width=400,Height=400,top=200,left=200');
}

This didnt work, got the error above.

I then tried another example

function newEvent(start, end, column)
{
document.location = 'bookingPopupNew.aspx?start='
+ encodeURIComponent(start.toUTCString())
+ '&end=' + encodeURIComponent(end.toUTCString())
+ '&column=' + encodeURIComponent(column);
}

This worked!

So I put it together into a dialog box showing details

function newBooking(start, end, column)
{
window.open('bookingPopupNew.aspx?start='
+ encodeURIComponent(start.toUTCString())
+ '&end=' + encodeURIComponent(end.toUTCString())
+ '&column=' + encodeURIComponent(column),
'PopupDetail','width=400,Height=400,top=200,left=200');
}

This works fine.

Can a VB examples section be put up on the site?

Cheers

John

John - 6/13/2008 6:32:37 PM
Oops, there was a typo in the example - it's fixed now. The openPopup() header should be

  function openPopup(start, end, column) {

rather than

  function openPopup(e) {

Thanks for posting the solution.

I'm working on the features documentation (DayPilotMonth and DayPilotScheduler are in progress now) and as soon as it's done I would like to add the VB.NET examples as well. Thanks for reminding this.
Dan Letecky - 6/16/2008 11:18:59 PM
Post reply