Skip to main content
Title grammar
Link
MrBoJangles
  • 12.3k
  • 17
  • 65
  • 83

Pass aan array from javascript to c#

deleted 97 characters in body
Source Link
Ovi
  • 2.6k
  • 9
  • 52
  • 72

I have a array in javascript and i need to get it to my c# webMethod. what is the best way to do this?

my c# code is like this:

 [WebMethod]
public static void SaveView(string[]  myArray, string[] filter)
{
}

EDIT--

My json data looks like this:

{"myArray":[{"name":"Title","index":"Title","hidden":false,"id":"1","sortable":true,"searchoptions":{"sopt":["cn","eq","bw","ew"]},"width":419,"title":true,"widthOrg":150,"resizable":true,"label":"Title","search":true,"stype":"text"},{"name":"Author","index":"Author","hidden":false,"id":"3","sortable":true,"searchoptions":{"sopt":["cn","eq","bw","ew"]},"width":419,"title":true,"widthOrg":150,"resizable":true,"label":"Author","search":true,"stype":"text"}],"filter":"{\"groupOp\":\"AND\",\"rules\":[{\"field\":\"Title\",\"op\":\"cn\",\"data\":\"10\"}]}"}

But i doesnt work... any idea why?

Thank you very much.

I have a array in javascript and i need to get it to my c# webMethod. what is the best way to do this?

my c# code is like this:

 [WebMethod]
public static void SaveView(string[]  myArray, string[] filter)
{
}

EDIT--

My json data looks like this:

{"myArray":[{"name":"Title","index":"Title","hidden":false,"id":"1","sortable":true,"searchoptions":{"sopt":["cn","eq","bw","ew"]},"width":419,"title":true,"widthOrg":150,"resizable":true,"label":"Title","search":true,"stype":"text"},{"name":"Author","index":"Author","hidden":false,"id":"3","sortable":true,"searchoptions":{"sopt":["cn","eq","bw","ew"]},"width":419,"title":true,"widthOrg":150,"resizable":true,"label":"Author","search":true,"stype":"text"}],"filter":"{\"groupOp\":\"AND\",\"rules\":[{\"field\":\"Title\",\"op\":\"cn\",\"data\":\"10\"}]}"}

But i doesnt work... any idea why?

Thank you very much.

I have a array in javascript and i need to get it to my c# webMethod. what is the best way to do this?

my c# code is like this:

 [WebMethod]
public static void SaveView(string[]  myArray, string[] filter)
{
}

EDIT--

My json data looks like this:

{"myArray":[{"name":"Title","index":"Title","hidden":false,"id":"1","sortable":true,"searchoptions":{"sopt":["cn","eq","bw","ew"]},"width":419,"title":true,"widthOrg":150,"resizable":true,"label":"Title","search":true,"stype":"text"},{"name":"Author","index":"Author","hidden":false,"id":"3","sortable":true,"searchoptions":{"sopt":["cn","eq","bw","ew"]},"width":419,"title":true,"widthOrg":150,"resizable":true,"label":"Author","search":true,"stype":"text"}]}

But i doesnt work... any idea why?

Thank you very much.

added 665 characters in body
Source Link
Ovi
  • 2.6k
  • 9
  • 52
  • 72

I have a array in javascript and i need to get it to my c# webMethod. what is the best way to do this?

my c# code is like this:

 [WebMethod]
public static void SaveView(string[]  myArray, string[] filter)
{
}

EDIT--

My json data looks like this:

{"myArray":[{"name":"Title","index":"Title","hidden":false,"id":"1","sortable":true,"searchoptions":{"sopt":["cn","eq","bw","ew"]},"width":419,"title":true,"widthOrg":150,"resizable":true,"label":"Title","search":true,"stype":"text"},{"name":"Author","index":"Author","hidden":false,"id":"3","sortable":true,"searchoptions":{"sopt":["cn","eq","bw","ew"]},"width":419,"title":true,"widthOrg":150,"resizable":true,"label":"Author","search":true,"stype":"text"}],"filter":"{\"groupOp\":\"AND\",\"rules\":[{\"field\":\"Title\",\"op\":\"cn\",\"data\":\"10\"}]}"}

But i doesnt work... any idea why?

Thank you very much.

I have a array in javascript and i need to get it to my c# webMethod. what is the best way to do this?

my c# code is like this:

 [WebMethod]
public static void SaveView(string[]  myArray)
{
}

Thank you very much.

I have a array in javascript and i need to get it to my c# webMethod. what is the best way to do this?

my c# code is like this:

 [WebMethod]
public static void SaveView(string[]  myArray, string[] filter)
{
}

EDIT--

My json data looks like this:

{"myArray":[{"name":"Title","index":"Title","hidden":false,"id":"1","sortable":true,"searchoptions":{"sopt":["cn","eq","bw","ew"]},"width":419,"title":true,"widthOrg":150,"resizable":true,"label":"Title","search":true,"stype":"text"},{"name":"Author","index":"Author","hidden":false,"id":"3","sortable":true,"searchoptions":{"sopt":["cn","eq","bw","ew"]},"width":419,"title":true,"widthOrg":150,"resizable":true,"label":"Author","search":true,"stype":"text"}],"filter":"{\"groupOp\":\"AND\",\"rules\":[{\"field\":\"Title\",\"op\":\"cn\",\"data\":\"10\"}]}"}

But i doesnt work... any idea why?

Thank you very much.

Source Link
Ovi
  • 2.6k
  • 9
  • 52
  • 72
Loading