return Object from Controller to another View in ASP.Net MVC -


i'm working on asp.net mvc , application display list of menues in list box , when click on items view display list of submenues , , have problem how return json view in first of controller return view model object view display on list box following

  return view(data); 

where data array of strings , , add event list box when selecting item

@html.orubase().listbox("list").rendermode(rendermode.auto).ios(c => c.showcorners(false)).binddatasource(model, map => {     map.mapto<string>(binding =>     {         binding.itemdatabound((item, nd) =>         {             item.text = nd;         });     }); }).onitemselect("select") 

where select javascript function call function in controller

function select(event, d) {        var index = d.selecteditemindex;         $.ajax({            url: '@url.action("getsubmenue", "home")',            type: 'get',            datatype: 'json',            data:{ind:index},            cache: false,             success: function (data) {             }        }); 

now getsubmenue function return following object "data" array of string

   return json(data,jsonrequestbehavior.allowget); 

now want getsubmenue function return json data object view view in new list so, can me please

you may want @ jquery templates. can render template out main view , when retrieve sub menu populate template json data.

alternatively return partialview ajax call , manually replace html in document.


Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

c++ - qgraphicsview horizontal scrolling always has a vertical delta -