in

Dé specialist in .NET trainingen en consultancy

Erik van Appeldoorn

april 2010 - Posts

  • Delphi 2009 resources

    Last week I did a Embarcadero Delphi 2009 course. While preparing this course I came to a number of resources on the web. If you need info about Delphi I would recommend the following sites:

    1. Delphi basics. A language reference guide to the OO Delphi language. http://www.delphibasics.co.uk/

    2. To download a Delphi Quick Reference Card look here: http://www.explainth.at/en/qr/dqr.shtml

    3. New Delphi language features since Delphi 7. http://edn.embarcadero.com/article/34324

    Posted apr 26 2010, 09:06 by Erik with no comments
    Filed under: ,
  • Custom ASP.NET MVC2 Data Annotations

    This afternoon we did some work to update our corporate site to MVC 2. We are using the new System.ComponentModel.DataAnnotations attributes to decorate our domain entities and by doing so you‘ll get some nice validation for free. 

    Introducing your own Data Annotation attribute for MVC2 is just a matter of creating a derived Class from ValidationAttribute and override the IsValid method.  By default this will be a server-side validator. To change that into a client-side validator takes some effort. The main steps are:

    - Create a new validator Class derived from the generic DataAnnotationsModelValidator<--your custom attribute Class goes in here—> Class. 
    - Register the validator and Custom attribute in global.asax.
    - Write a custom JavaScript validation function.

    For all the details I would recommend reading this excellent article about ASP.NET MVC 2 Custom validation.