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.
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
Post a Comment