Home Unanswered Active Tags New Question

JsonData, client-side array as a param

Hi,
I would like to use some code like this:

function updateScheduler(source, args) {
var args2 = new Array('1', '2', '3');
dps1.commandCallBack("refresh", args2);
}

And get my argument array object from code-behind:

protected void DayPilotScheduler1_Command(object sender, DayPilot.Web.Ui.Events.CommandEventArgs e)
{
DayPilot.Json.JsonData args = e.Data;
}

But I got this error:

An exception was thrown in the server-side event handler:

System.InvalidCastException: Instance of JsonData can't be cast to String.
at DayPilot.Json.JsonData.op_Explicit(JsonData data)
at Scheduler_MyScheduler.DayPilotScheduler1_Command(Object sender, CommandEventArgs e) in c:\Users\josep.porcar\Documents\Visual Studio 2010\Projects\MyScheduler\MyScheduler\Scheduler\MyScheduler.ascx.cs:line 539
at DayPilot.Web.Ui.DayPilotScheduler.ExecuteEventJSON(String ea)
at DayPilot.Web.Ui.DayPilotScheduler.System.Web.UI.ICallbackEventHandler.RaiseCallbackEvent(String ea)
at System.Web.UI.Page.PrepareCallback(String callbackControlID)

Is it possible to achieve this?
Thanks.

Asked by Josep 5 months ago.
2 other people also want an answer.
Replies

This code seems to be fine. This exception would be thrown if you used something like this:

protected void DayPilotScheduler1_Command(object sender, DayPilot.Web.Ui.Events.CommandEventArgs e)
{
  string args = (string)e.Data;
}
Answer posted by Dan Letecky [DayPilot] 5 months ago.
New Reply
This reply is
Your name (optional):

DayPilot for ASP.NET WebForms, DayPilot for ASP.NET MVC, DayPilot for Java