when i was debugging, i checked the value of "this.dataset.name", it's value is "one". and on server when i hit the break point at controller which recieves menu object, is not recieving menu object. here is the code.
public ActionResult getcontent(menu m)
{
viewmodelsub vms = new viewmodelsub();
vms.n = db.navimenus.Where(r => r.menuname == m.name).ToList();
vms.p = db.posts.Where(r => r.navname ==vms.n.FirstOrDefault().navname).ToList();
return Json(vms) ;
}
sean freeman
Member
170 Points
96 Posts
Model biding sucks!
May 07, 2012 12:21 PM|LINK
MVC modelbiding is not working anymore. i spent alot of time trying to post some json object to my server.
mvc class: Menu
public class menu
{
public string name {get;set;}
}
my javascript on the browser which sends json to server using ajax.
request.send(JSON.stringify({ name: this.dataset.name }));when i was debugging, i checked the value of "this.dataset.name", it's value is "one". and on server when i hit the break point at controller which recieves menu object, is not recieving menu object. here is the code.
public ActionResult getcontent(menu m) { viewmodelsub vms = new viewmodelsub(); vms.n = db.navimenus.Where(r => r.menuname == m.name).ToList(); vms.p = db.posts.Where(r => r.navname ==vms.n.FirstOrDefault().navname).ToList(); return Json(vms) ; }Can anyone please help me with this?