Why Repeaters in ASP.NET? Why Repeaters in ASP.NET? asp.net asp.net

Why Repeaters in ASP.NET?


Repeaters fit nicely into the code-behind approach. I spent many years where I couldn't stand the sight of any code in the markup. All code belonged in the code-behind separated from the markup. This was largely a reaction to the horrid messes I dealt with in classic ASP.

Now with ASP.Net MVC, I find I'm going back to exactly what you describe above. But, I'm finding it hard to overcome the instinct to keep markup and code separate.

Edit: Here's an article from 2003 about the debate regarding code-behind.


Microsoft frequently tries to maximize what you can do without coding. You can do a lot with repeaters without any code-behind. With data source controls you can do a whole lot without any code at all. One can suppose that as a corporate strategy they want to have the easiest-to-use development environment, and "no code at all" is apparently someone's definition of easy to use.

But when you want to move beyond the free automatic behaviors you are knee deep in an event model with lots of twisty passages which all look alike. I am fond of perl's motto, "make the simple things simple and the hard things possible", and Microsoft sometimes seems to prefer "make the simple things trivial and everything else hard".

Some have mentioned that the ASP.Net MVC moves away from this. If true, this is the best news I have heard all day.


I think the primary aim of repeaters is to keep procedural code out of the view/markup. The idea being that someone who is a graphic/aesthetic designer can come in and change the markup without having to know how to 'code'. Probably of greater concern to you is that lots of people in the .NET world are familiar with the repeater which means it will be easier for them to maintain.