Archive for March, 2010

ASP .NET MVC2 Changes: GetControllerInstance & DataAnnotationsModelBinder

Tuesday, March 30th, 2010

So was in the process of updating my mvc app, there is a tool that does it for you and also a manual way . But once you have updated there are also 2 more changes that you may need if you are using IoC or DataAnnotations. First you will need to change the method [...]

Share

SparkViewEngine: Highlight Table Alt Row

Monday, March 29th, 2010

Here is how one highlights an alt row with spark, quite clean I tell you. Assuming you have a css that like below. ?View Code CSS1 2 3 4 5 6 tr.alt { text-align: left; padding: 2px; border: 1px solid #000; background: #ADDFFF; } And in your template you will call it like this. ?View [...]

Share

Linq: Sequence contains no matching element

Friday, March 26th, 2010

So sometimes you will get these strange errors or exceptions when using linq. For example if you use ?View Code CSHARP1 var result = myEnumerableCollection.First(x => x.Name == person.Name); This will throw InvalidOperationException with Sequence contains no matching element. But if you use ?View Code CSHARP1 2 3 var result = myEnumerableCollection.FirstOrDefault(x => x.Name == [...]

Share