ASP.Net MVC views are harder to read when they’re built with a lot of escapes between script and HTML, such as:
There’s really just no good way to make that easy to read using this approach.
Using the MVC Futures Repeater Control
Server controls and MVC just don’t sound like they’d go together, but if used for good I believe they can really serve a useful purpose. The following code snippet achieves the exact same result as above, but reads much cleaner:The MVC Futures repeater control gives me a way to display repeating data with a template. The control is “bound” to the Model.Items collection because I set the name of the repeater to “Items”.
To get a reference to this control you need to include a reference to the MVC Futures assembly in the web.config:
The complete solution with this code can be downloaded here:
2 comments:
Yeah, but you lost your strongly typed-ness with that kind of binding.
Interesting, but what's the deal with the "Eval"s in there? I'd much rather see "item..About" than "Eval("About")". Is that possible?
Post a Comment