Here are some changes that affected my asp mvc update process, specifically ASP .NET MVC2 Changes: GetControllerInstance & DataAnnotationsModelBinder. By the way, 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 […]
Archive: March 2010
So you want to use Spark View Engine: Highlight Table Alt Row. Here is how one highlights an alt row with spark, quite clean I tell you. Assuming you have a css that like below.
1 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.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
<table> <tr> <th>ID</th> <th>FirstName</th> <th>LastName</th> <th>Gender</th> </tr> <tr each="var person in people" class="alt?{personIndex % 2 == 0}"> <td>${person.Id}</td> <td>${person.FirstName}</td> <td>${person.LastName}</td> <td>${person.Gender}</td> </tr> </table> |
Note: How I am using personIndex. It basically […]
So sometimes you will get these strange errors or exceptions when using Linq Sequence contains no matching element For example if you use
1 |
var result = myEnumerableCollection.First(x => x.Name == person.Name); |
This will throw InvalidOperationException with Sequence contains no matching element. But if you use
1 2 3 |
var result = myEnumerableCollection.FirstOrDefault(x => x.Name == person.Name); if(result == null) //did not find in the collection something went wrong or ..... |
Which will return you a null if its not found then you can check if the […]