c# - How to attach jstree nodes in form using jquery and receive in MVC Model? -


i have form multiple jstree elements. gathered jstree nodes using code:

var treedata = $('.jstree').jstree(true).get_json('#', { flat: false }); var jsondata = json.stringify(treedata); 

result array of objects. each node has array of children too. in server-side have model this:

 public class samplemodel {     public int id { get; set; }     public string name { get; set; }     public list<jstreenode> products { get; set; } } 

and jstreenode this:

public class jstreenode {     public string id { set; get; }      public string text { set; get; }     public string icon { set; get; }     public jstreenodestate state { set; get; }     public list<jstreenode> children { set; get; }     public jstreenodeliattributes li_attr { set; get; }     public jstreenodeaattributes a_attr { set; get; }     public string data { get; set; }      public jstreenode()     {         state = new jstreenodestate();         children = new list<jstreenode>();         li_attr = new jstreenodeliattributes();         a_attr = new jstreenodeaattributes();     } } 

i tried append jstree data(appending treedata , or jsondata ).

var formdata = new formdata($("form").get(0)); formdata.append('products', treedata); 

but nothing received in server-side. how can tree structure in server.


Comments

Popular posts from this blog

php - How to display all orders for a single product showing the most recent first? Woocommerce -

asp.net - How to correctly use QUERY_STRING in ISAPI rewrite? -

angularjs - How restrict admin panel using in backend laravel and admin panel on angular? -