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

"The request must start in "JSON" string " error occur in asp.net mvc rezor c# schedule deleopment

Asked by Manojit Mondal
8 years ago.

Hi ,
I have a serious error occur when i run the application using daypilot mvc rezor source code. I follow this link "http://kb.daypilot.org/67316/how-to-show-an-event-calendar-in-asp-net-mvc-3-razor/" to create my project.

The error occurs in the controller Index(). the function is

public ActionResult Index()
{
return new Dpc().CallBack(this);
}
class Dpc : DayPilotCalendar
{
protected override void OnInit(InitArgs e)
{
var db = new DataClasses1DataContext();
Events = from ev in db.events select ev;

DataIdField = "id";
DataTextField = "text";
DataStartField = "eventstart";
DataEndField = "eventend";

Update();

}
}

And my Index page source code is
@using DayPilot.Web.Mvc
@using DayPilot.Web.Mvc.Events.Calendar;
@using DayPilot.Web.Mvc.Enums.Calendar;

@{
ViewBag.Title = "Index";
}

<h2>Schedule</h2>
<script src="@Url.Content("~/Scripts/DayPilot/Common.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/DayPilot/Calendar.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/DayPilot/calendar.src.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/DayPilot/common.src.js")" type="text/javascript"></script>

@Html.DayPilotCalendar("dpc", new DayPilotCalendarConfig
{
BackendUrl = Url.Content("~/Schedule/Index"),
EventMoveHandling = EventMoveHandlingType.CallBack
})

I also attached the two jpg file to see what happens.

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

Please see section #3 of the tutorial (3. MVC 3 Controller).

There are two Actions that need to be created:

  • Index (opens the view)
  • Backend (backend for internal ajax callbacks)

If you open the action that is mapped to Dpc().Callback() in the browser you will receive this error. This URL can't be opened directly.

You should rename Index() to Backend() and add a new Index() action as described in the tutorial.

Comment posted by Manojit Mondal
8 years ago.

Thank you. It is working now.

Comment posted by Allan Levsen
7 years ago.

Dan,

I'm just getting started and will need to purchase the Developer version from you soon... I just need to make sure this will work for our application first.

So, I'm using VS2012 .net 4.5 mvc 4 I have moved the TutorialMvc3CalendarRazor CS example (very straight forward) into my app - double - double checked everything is exactly the same but for some reason I am getting the following issue in the BackEnd(); I'm getting an exception at the :

public ActionResult Backend()
{

return new Dpc().CallBack(this);
}

the exception is saying Value cannot be null... any ideas

Allan

using Firebug... here is the error

POST http://localhost:49802/Calendar/Backend

500 Internal Server Error
9.34s
common.js (line 2)
HeadersPostResponseHTML
Parametersapplication/x-www-form-urlencoded
JSON{"action":"Init","hea...
Source
JSON{"action":"Init","header":{"control":"dpc","id":"dpc","clientState":{},"columns":[{"Value":null,"Name":"10/25/2012","ToolTip":null,"Date":"2012-10-25T00:00:00","Children":[]}],"days":1,"startDate":"2012-10-25T00:00:00","cellDuration":30,"cssOnly":false,"cssClassPrefix":"calendar_silver_","heightSpec":"BusinessHours","businessBeginsHour":9,"businessEndsHour":18,"viewType":"Days","dayBeginsHour":0,"dayEndsHour":24,"headerLevels":1,"backColor":"#ffffff","nonBusinessBackColor":"white","eventHeaderVisible":true,"timeFormat":"Clock12Hours","timeHeaderCellDuration":60,"showAllDayEvents":false,"hourNameBackColor":"#F3F3F9","hourFontFamily":"Tahoma, Arial, Helvetica, sans-serif","hourFontSize":"16pt","hourFontColor":"#42658C","selected":[]}}

Comment posted by Allan Levsen
7 years ago.

Hello Dan,

I have checked into this a bit and the exception it's the ColumnCount throwing the exception.... would you know of the top of your head why? The tutorial works great but not in my project???

Allan

This question is more than 3 months old and has been closed. Please create a new question if you have anything to add.