TryParse Extension Methods

When .NET 2.0 was released, a TryParse() method was added to many value types such as Int32, DataTime, etc. This was a huge improvement because there was no longer a need to catch expensive exceptions and drag down performance. However, one drawback of the TryParse() method is that the syntax is a little clunky. The most common example looks like this: Person person = new Person(); string value = "21"; int num; int.TryParse(value, out num); person.Age = num; So it's great that we can do all...



Enterprise Library Validation Application Block with ASP.NET MVC

Several weeks ago (before the release of the CTP5 of MVC) I posted a way to leverage the EntLib Validation Application Block with MVC [http://geekswithblogs.net/michelotti/archive/2008/06/17/122931.aspx]. Since then CTP5 has been released and this finally includes a mechanism for reporting validations.  It is important to note that it does not include the mechanism for how to do validation but rather how to report validations.  This is actually a great thing because, first off, it allows the f...


Use jQuery with ASP.NET with jQuery.noConflict()

The jQuery [http://jquery.com/] Javascript library has gotten a significant amount of attention from Microsoft developers this year in large part to its nice fit with the new ASP.NET MVC framework.  I myself was totally new to jQuery and I started using it with MVC because I wanted to see what the big deal was.  Sure enough, I became a true believer like many others.  And I found myself suddenly having "JavaScript envy" because I couldn't do all the cool jQuery stuff in traditional ASP.NET (i.e...


Use PowerShell to Clean your Visual Studio solution

There are lots of times when I want to do a "Clean" of my VS.NET solution.  Obviously, the most common way to do this is to right-click your solution in the solution explorer and select "Clean Solution".  However, there are 2 drawbacks of this.  One is that if you have files sitting in your bin or obj directories that are not in some way linked to your solution, they won't be removed.  Additionally, sometimes you just want to do a quick clean of a directory structure without having to fire up VS...