Automatic Marking of Required Fields with EditorEntryFor

Using an EditorEntryFor helper makes the code DRYer and opens new possibilities, such as automatic indication of required fields. A small addition in one helper method will mark all required fields in entire MVC web application. It’s more or less standard to indicate required fields in a form with a red * next to the… Continue reading Automatic Marking of Required Fields with EditorEntryFor

DRYing MVC Forms with an EditorEntryFor Helper

When creating forms in ASP.NET MVC I use a small helper to keep the code DRY (Don’t Repeat Yourself). The EditorEntryFor helper creates everything needed for a form field – the label, the input and the validation. When creating line of business applications, a huge part of the coding is often to create forms. Each… Continue reading DRYing MVC Forms with an EditorEntryFor Helper

Merging Expression Trees to Reuse in Linq Queries

Reusing parts of LINQ queries is easily done by chaining methods returning IQueryable. Unfortunately that doesn’t cover some senarios like reusing member initialization lists. To handle such a situation I wrote a Merge extension method for select expressions. For this post we’ll load the data required for a list of cars and a detail view… Continue reading Merging Expression Trees to Reuse in Linq Queries