Showing posts with label asp.net MVC. Show all posts
Showing posts with label asp.net MVC. Show all posts

Thursday, February 14, 2013

MVC - Designing the "Model" part of MVC

Yesterday I found myself struggling with the idea of how to implement the Model part of an MVC application in an organized and maintainable way. While googling my way I came across with this two articles that I've found very interesting, and have helped me to clear my thoughts a bit:

http://geekswithblogs.net/michelotti/archive/2009/10/25/asp.net-mvc-view-model-patterns.aspx
http://lostechies.com/jimmybogard/2009/06/30/how-we-do-mvc-view-models/

Tuesday, February 12, 2013

Best practices for ASP.NET MVC

A must read if you are developing with MVC, from the ASP.NET and Web Tools Developer Content Team blog.

Best Practices for ASP.NET MVC:
http://blogs.msdn.com/b/aspnetue/archive/2010/09/17/second_2d00_post.aspx

Thursday, November 29, 2012

HOWTO trigger MVC 3 validation from jQuery


Have you ever wonder how to trigger de MVC 3 form validations from jQuery? ... well, I've done it, and belive me, I spend more than an hour finding out how to. So, the answer is pretty simple: to trigger the validators do something like
$('#MyForm').validate().form();
And for checking if the all the validations get passed look for something like
var isMyFormValid = $('#MyForm').validate().valid();
That's all.

(The answer was found thanks to the ASP.NET forums)

Friday, November 23, 2012

Thursday, November 22, 2012

Brief introduction to MVC 3 partial views

Here's a brief and to the point introduction to MVC 3 partial views by Microsoft's Rachel Appel:

http://rachelappel.com/razor/partial-views-in-asp-net-mvc-3-w-the-razor-view-engine/

The introduction covers in less than 10 minutes the following topics:

  • What is a partial view and when should I use it?
  • Rendering partial views
  • Creating a partial view
  • Sharing Data between views and partial views

Wednesday, November 21, 2012

HOW TO: embed MVC 3 Razor code inside a javascript block

This one is actually a kind of weird trick that's is required (as far as I know) in the current version of MVC for embedding razor code inside a javascript block. It's very possible that you find yourself wondering how to accomplish this when you are begining with MVC and razor:

http://stackoverflow.com/questions/4204669/asp-net-mvc3-rc-razor-views-syntax-for-embedding-code-inside-javascript-bloc

P.S. I'm not sure if this is still necessary in the current version of MVC (MVC 4 ath the time of this writing)...

Thursday, September 20, 2012

So .NET MVC is Open Source? ... yes, it is!

Recently I had a doubt about the insides of a .NET MVC method, so I posted a question on SO. To my surprise, one of the answers told me to take a look at the source code by myself... and then I met The Source Code:

http://aspnetwebstack.codeplex.com/SourceControl/list/changesets

A highly recommended resource for every MVC programmer out there.