Skip to content

Category Archives: MVC

Announcing Planet ASP.NET MVC

02-Dec-09

I’ve created a “Planet” type site that aggregates posts from different sources about the ASP.NET MVC Framework. Feel free to suggest new feeds you’d like to see on here. Content owners, I’ve made every effort to ensure proper attribution (e.g. the link here and the link in the feed point to the source of the [...]

ASP.NET MVC Tip – Return specific views for specific errors.

18-Mar-09

Earlier I had said to keep your controllers as thin as possible, that doesn't mean that they should necessarily just be two, or one, lines of code.
Take an instance where you are retrieving items from a web service in your controller. Let's say that you get a 404 error and your service will throw [...]

ASP.NET MVC tip – Don’t use the Content or Scripts directories for view specific files

17-Mar-09

ASP.NET MVC creates a default file structure for you when you create a new project. It includes a Scripts directory, which contains the MS AJAX and jQuery .js files, and a content directory, which contains a Master page and CSS files. I find this to be extremely cumbersome and it forces me to jump around [...]

ASP.NET MVC TIP – Keep your controllers and actions thin

16-Mar-09

When writing you controller actions, keep them short and sweet. Don't add a lot of actions and keep a close eye on the length of each action.
Whenever possible, I try to make my controller actions look something like this.
PLAIN TEXT
CODE:

public ActionResult DoSomething()

{

    MyModel model = MyService.GetModel();

    return View("MyView",model);

}

//or

public ActionResult DoSomethingWithAKey(int myKey)

{

    MyModel [...]

Get Adobe Flash playerPlugin by wpburn.com wordpress themes