javascript - Pass IEnumerable List data to Controller -


i need pass model.component_grouppanel_component list controller. have following code couldn't achieve it.

code in view:-----

var test = { rows : @html.raw(model.component_grouppanel_component) ,         cmp_db_id: @model.component_grouppanel_component[0].child_cmp_dbid };  $("#btnupdate").click(function() {         $.ajax({             url: "@url.action("editmy", "componentgrouppanel")",             data: json.stringify(test),             type: 'post',             contenttype: "application/json",         });     }); 

code in controller:-----

public jsonresult editmy(ienumerable<cmp_grouppanel_cmp> rows, int cmp_db_id) {             return json(true);         } 

i think looks should using ajax action link. available in razor can run client side code here , load objects need.

https://msdn.microsoft.com/en-us/library/system.web.mvc.ajax.ajaxextensions.actionlink(v=vs.118).aspx

http://www.c-sharpcorner.com/uploadfile/abhikumarvatsa/ajax-actionlink-and-html-actionlink-in-mvc/

if need run partial postback, use ajax form in razor.

http://www.codeproject.com/articles/429164/html-beginform-vs-ajax-beginform-in-mvc

hope helps


Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -