2
votes

Simplify Iteration in Your MVC Views « Steve Sanderson’s blog

posted by MicrosoftMicrosoft 305 days, 1 hour, 36 minutes ago
Monday, September 28, 2009 8:31:53 AM GMT

This is just a simple little tip, but it may come in handy if you frequently iterate over collections in your ASP.NET MVC views. How often do your ASP.NET MVC views need to iterate over a collection to render some HTML for each item? For example, if your model is a collection of Person objects, and you want to render a table of them, you might write view code as follows:

A few bits of this code make me uncomfortable:In order to render “even” and “odd” and “last” CSS classes, I used a series of ...

category: ASP.NET | clicked: 0 | | source: blog.codeville.net | show counter code
tags: ASP.NET MVC, CSS, MVC Views, Steve Sanderson

No comments yet, be the first one to post comment.

To post your comment please login or signup