Assuming that the data has been retrieved from the Db and put into an object people.
foreach (People p in people)
{
// create an html button for each p
PlaceHolder1.Controls.Add("control");
}
Although it does not follow the MVC pattern, I would like a method that loop through the data in the controller. I have been trying to do this with dynamic controls which has turned into a major nightmare.
EDIT: I would like to use Webform but not for the creation of dynamic content. If for example you created a CRUD system with dynamic controls against a db, the complexity of keeping the creation, deletion in the db in sync with the actions in the page lifecycle is fairly great. For all other static content, webforms are actually pretty decent.
So, to recap, the solution I am looking for would actually exist in a webforms page, however, the loop would not create dynamic webform controls, but rather standard html controls.
You would pass the collection to the view. Then iterate through each item in the collection and add the html code there.