Some daily notes on learning ASP.NET MVC
- You don't need a view for every controller action. For instance you can return a JsonResult for Ajax requests.
- When using jQuery to post AJAX requests, it's easiest to use $.getJSON because it automatically creates the JSON object for you. Otherwise you can use: var x = Eval(data); to get a hold of a json object.
- Very low need for custom routes so far, unlike other MVC frameworks I've used. The default seems to work fine for most needs.- Data can be returned to a page two ways: Through ViewData collection (good if you have multiple sources of data), or through the Model.
- View Data needs to be cast to it's proper type before you use it. Makes things sort of messy.
- Return data to the model via 'return View(object);' in the controller. Make sure to modify the Inherit declaration at the top of the view: "System.Web.Mvc.ViewPage<List<MvcApplication1.Data.Job>>".



