Sending an array of complex objects in the get string in C# ASP.NET MVC -


i want send array of objects in request string. know isn't optimal solution, want , running.

if have class, this

public class data {    public int { get; set; }    public int b { get; set; } }  public class requestviewdata {    public ilist<data> mydata { get; set; } } 

i thought bind mvc route web request this

http://localhost:8080/request?mydata[0].a=1&mydata[0].b=2&mydata[1].a=3&mydata[1].b=4 

but create array of 2 data objects without populating values 1,2, 3 or 4.

is there way bind complex objects arrays?

assuming have implemented method getarraytest in homecontroller

public class homecontroller {     public actionresult getarraytest (list<data> data)  } 

the following work.

http://localhost:8080/home/getarraytest?data[0].a=1&data[0].b=1&data[1].a=2&data[1].b=2&data[2].a=3&data[2].b=3


Comments

Popular posts from this blog

javascript - Enclosure Memory Copies -

php - Replacing tags in braces, even nested tags, with regex -