views:

621

answers:

0

Im trying to incorporate jQuery plugin FullCalendar into my application.

All was going well until i decided to implement the dropping of a calendar event in the calendar. for this i hooked up the following code to the eventDrop eventhandler (jquery / clientside)

eventDrop: function( event, dayDelta, minuteDelta, allDay, revertFunc, jsEvent, ui, view ) 
{
         jQuery.post('/FullCalendarEventEdit/', event, 
                 function(data) { FullCalendarEventEditCallback(data); } 
          );
};

at this time i was still using ASP.NET-MVC 1.0 with jQuery 1.4.1 (which i've added myself). It threw me an exception (which i cant reproduce atm since i'v changed a lot around in trying to fix it, but it was MicrosoftAjax.debug.js which trew the exception)

Then i realised jQuery 1.4.1 and MVC 1.0 might not work well together so i reverted back to jQuery 1.3.2.

Now i got the problem that jQuery.parseJSON is missing, so i cant manually parse the json-serialized (by json.net) data which my

FullCalendarEventEditCallback(data){ 
    var jsonCal=data.get_data();
    var newCalEvent = jQuery.parseJSON(jsonCal)l
    .........
}

is getting back from the postcall. (i realize i can put 'json' as datatype in my .post call, but i dont want this, since this callback will be called as well when i dont use jQuery but just plain old Ajax.Beginform ( "FullCalendarEventEdit" , new AjaxOptions { httpMethod = "POST " , oncomplete = "FullCalendarEventEdit" } in a editform (which is been shown on eventClick) ) Using eval() here isn't working either, googling eval tells me its generally a bad idea to use eval anyway

so next step.. upgrading to MVC2 RC2 which comes with jQuery 1.4.1: Now the callback works perfectly fine if i use it with the edit form (which it did in the first place with MVC 1.0 + jQuery 1.4.1).

but now my .post call in eventDrop throws a exception again:

Microsoft JScript runtime error: 'dateTimeFormat' is null or not an object

(in line 2625 of MicrosoftAjax.debug.js) :

2624 Date.prototype._toFormattedString = function Date$_toFormattedString(format, cultureInfo) {
2625     var dtf = cultureInfo.dateTimeFormat,  // <-- here
2626        convert = dtf.Calendar.convert;     // <--throws Calendar = null as well..

this does not happen when i only post event.id for example.. it DOES happen when i post event.start or event.end (thus a javascript DateTime)

i guess somehow MicrosoftAjax wants to be involved in parsing DateTime objects.. Why is this? how can i tell it not to? This a bug which has not been resolved? am i just doing things wrong? (imho, im just posting a object which i cant realy change (since the FUllCalendar plugin gives me this). this should be possible without any hassle i'd say)