devermind.com
Adrian Grigore’s software development weblog. Motto: I will not waste my time looking for a clever motto.
  • Home
  • About
  • Contact me
  • Privacy Policy

ASP.NET MVC Category

ASP.NET MVC Beginner’s Guide

ASP.NET MVC 3 Comments »

I’ve decided take Microsoft’s brand new ASP.NET MVC framework for a small test drive by building a small proof of concept application with it. The frame work sure looks promising, even despite it’s early stage of development and relatively small features as compared to ASP.NET web forms.

It seems there are no good books available on the subject yet. The few that are already in stock at Amazon are based on the community preview, and it seems that there have been quite a few changes in the the framework since then.

Fortunately, ScottGu hat just released a free sample chapter of his upcoming “Professional ASP.NET” (Wrox) book. It contains a 200-page walkthrough guide on how to build a simple ASP.NET MVC application.

The chapter is available for download here.


March 17th, 2009 |

Tags: ASP.NET, guide, LINQ, mvc, tutorial




ASP.NET MVC Tip #1: Using Custom ViewModels with POST action methods

ASP.NET MVC, LINQ 14 Comments »

One of the top good practices for ASP.NET MVC is not to use the ViewData Dictionary, but to put your data in a strongly typed ViewModel instead. Many people seem to be using Linq to SQL entities as a ViewModel, because it’s a very comfortable approach. But what do you do if your view should contain data that is not included in any of your linq entities? Scott Gu’s chapter 1 preview of his upcoming ASP.NET MVC book recommends using a custom-shaped ViewModel for those cases. (more…)


April 18th, 2009 |

Tags: ASP.NET MVC, binding, custom, mvc, POST, viewmodel




ASP.NET MVC Tip #2: Turn on compile-time View Checking

ASP.NET, ASP.NET MVC 43 Comments »

I like the compiler to catch as many errors as possible before I start debugging or release my application. This also applies to code nuggets in ASP.NET MVC views, especially since these are not easily unit-testable. But views are not validated at compilation, at least not when using the standard settings for ASP.NET MVC projects.

Tools like Resharper can notify you of syntax errors within your views, but you can still build the project and not get a single error. Instead, your application will crash when trying to evaluate the buggy view.

Fortunately you can easily make Visual Studio compile your views along with the rest of your code. (more…)


May 3rd, 2009 |

Tags: ASP.NET MVC, MSBuild




ASP.NET MVC Tip #3: Client-side form validation made easy – Part 1

ASP.NET MVC 33 Comments »

Client-side form validation has become a de-facto standard for modern web applications. However, replicating server-side validation rules on the client side can be a tedious and error-prone process.

In addition, there are some validation rules which cannot be checked completely on the client side, for example because the validation depends on information stored in the server database. For those rules you need to implement remote client-side form validation.

The xVal framework is great for automatic generation of client-side validation code for some of your server-side validation rules, but it does not support remote client-side validation.

This article shows a fully generic way to implement remote client-side form validation so that

• Validation rules remain solely in your ASP.NET MVC model
• You write each validation rule just once, and only in easily testable C# code. There is no JavaScript or other client-side counterpart .
• There is no need to branch or otherwise modify xVal or jquery.validate
• All you have to do for each new remote form validation rule is to derive from the base class shown in this article.

I’ll describe how to implement this in detail. I’ve also uploaded a demo project showing how this works in action.

(more…)


June 21st, 2009 |

Tags: ASP.NET MVC, client-side form validation, client-side validation, dataannotationsmodelbinder, form validation, jQuery, jQuery.validate, remote validation, xVal




ASP.NET MVC Tip #4: Client-side form validation made easy – Part 2

ASP.NET MVC 5 Comments »

In my previous article about ASP.NET MVC Client-Side validation, I showed how to set up your project so that you don’t have to write any custom JavaScript code for any new validation rules. This approach also covered remote client-side validation – these are rules which require server-side resource in order if a particular input field is valid or not.

Since I wrote the first part of the article, Steve Sanderson adopted my idea of automatic client-side validation and baked a similar feature right into the latest version of xVal.

One important thing is still missing though: What do you do when validation depends on server-side resources but also involves several different form fields? For example, let’s assume you were implementing a form for your website users to update their contact information.

(more…)


January 11th, 2010 |

Tags: ASP.NET MVC, client-side form validation, client-side validation, dataannotationsmodelbinder, form validation, jQuery, jQuery.validate, remote validation, xVal




  • Feeds

    • RSS feed iconAll Entries
    • RSS feed iconAll Comments
    • RSS feed iconThis Category
  • About Adrian Grigore

    Adrian Grigore Adrian is a software developer from Fulda, Germany. Adrian has been programming C++ applications since 1998. Recently he has been implementing a Web 2.0 SaaS website, so his current development-related interests are ASP.NET MVC, C#, and jQuery.


  • Adrian's (German language) book

    XSLT XUpdate BuchXUpdate mittels XSLT - Ein XUpdate-Prozessor auf XSLT-Basis


  • Pages

    • About
    • Contact me
    • Privacy Policy
  • Links

    • Lobstersoft
    • SonicWeasel
  • Tags

    ASP.NET ASP.NET MVC binding Business client-side form validation client-side validation CSharp custom DAL dataannotationsmodelbinder form validation games guide jQuery jQuery.validate LINQ MSBuild multi-tier mvc POST remote validation shareware tutorial viewmodel visual-studio asp.net xVal
  • Archive

    • January 2010 (2)
    • June 2009 (1)
    • May 2009 (1)
    • April 2009 (1)
    • March 2009 (2)
    • February 2009 (1)
    • October 2008 (2)
Copyright © 2010 devermind.com All Rights Reserved
RSS XHTML CSS Log in
Wp Theme by n Graphic Design
Powered by Wordpress