I’ve got a view with a few simple fields and a jQuery grid. The fields I populate via my Model so my first thought was to try and populate my grid via the same way. The thing is that after banging my head against the problem for a bit I started to wonder if maybe I was trying to go against the grain to much. It seems like the generally accepted practice (and more importantly how things are designed) that components on the view which use json for their data work best when they can make a separate call to get a JSONResult returned which they will then process.
Normally this wouldn’t be a big deal but for various future proofing reasons (not my decision.. the fun of having an architect) we’ve got a separate WCF layer that our MVC layer calls. So now I have to be worried about making too many granular calls. This is what actually lead me to try the model based population approach. What I’m wondering is how common this approach is or if everyone just has a bunch of controller methods for their UI components to call to get JSON?
I use a standard generic model for JSON results like
Then I have standard generic send/receive JSON methods in JavaScript.