I can't remember where I read this, but it applies to you:
-- But won't we nead at least a repeater control in MVC?
-- We have a repeater control. It's called a for each loop
Let's say your view model has a property called Data
of type IEnumerable<SuperDuper>
. To iterate over it, you'd just do
<% foreach (var sd in Model.Data) { %>
<!-- write out fancy stuff -->
<% } <%>
To iterate over subdata, let's say that SuperDuper
has a property named SubData
that's also an IEnumerable<Something>
. Nothing stops you from doing
<% foreach (var sd in Model.Data) { %>
<!-- write out some fancy stuff -->
<% foreach (var sub in sd.SubData) { %>
<!-- write out some more fancy stuff -->
<% }
} %>
For the two-column layout, resort to CSS.
And since Razor is on it's way, I can't resist to show you what those examples would look like with the new engine:
@foreach (var sd in Model.Data) {
<!-- write out fancy stuff -->
}
@foreach (var sd in Model.Data) {
<!-- write out some fancy stuff -->
@foreach (var sub in sd.SubData) {
<!-- write out some more fancy stuff -->
}
}