How to get the JSON from the controller to display in the view of ASP.net MVC 2 -
i trying query data database, in order take create main menu in asp.net mvc 2 web site.
this code in controller :
public jsonresult getmenu(string id) { jsonresult jr = new jsonresult(); var ien_menu = ( d in this.datacontext.departments join c in this.datacontext.categories on d.id equals c.departmentid join in this.datacontext.items on c.id equals i.categoryid d.active == 1 && d.activeinweb >0 && c.active > 0 && c.activeinweb >0 && i.active > 0 select d ).distinct() .orderby(s=>s.name); jr.data = ien_menu.tolist(); jr.jsonrequestbehavior = jsonrequestbehavior.allowget; return jr; }
but have no idea how take data , display in partial views. need do?
how calling controller action? can use jquery json results if loading via ajax. @ success function data - http://api.jquery.com/jquery.ajax/
Comments
Post a Comment