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

JsonData, client-side array as a param

Asked by Josep
13 years ago.

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.

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

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;
}
This question is more than 1 months old and has been closed. Please create a new question if you have anything to add.