Reputation: 3611
I'm trying to loop through a data set on the server-side (not a problem) and dynamically render HTML based on the items in the dataset (super basic stuff). Here's the simplified HTML:
<div>item title</div>
<div>item date</div>
<div>item summary</div>
I have 10 items being returned on the back-end, so I'd like to write out 10 iterations of the HTML above. I know this is super basic stuff, but I'd like to do this in ASP.NET without 1) embedding HTML in the C# code 2) embedding C# in the ASPX code
Is this possible? What's the best way to do this? I'm also not using MVC, so please keep that in mind. Thank you.
Upvotes: 1
Views: 297
Reputation: 39248
I would consider using a Repeater
for this
http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.repeater(v=vs.110).aspx
It's a control designed for repeating arbitrary html based on the content of a data source
Upvotes: 3