Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [snip]
- <body>
- <form id="form1" runat="server">
- <% Somethings.ForEach(s => { %>
- <h1><%=s.Name %></h1>
- <h2><%=s.Id %></h2>
- <% }); %>
- </form>
- </body>
- </html>
- [snip]
- public partial class _Default : System.Web.UI.Page
- {
- protected List<Something> Somethings { get; private set; }
- protected void Page_Load(object sender, EventArgs e)
- {
- Somethings = GetSomethings(); // Or whatever populates the collection
- }
- [snip]
- List<YourClass> myObjects = SomeMagicMethodThatGetsAllInstancesOfThatClassAndAddsThemtoTheCollection();
- foreach (YourClass instance in myObjects)
- {
- Response.Write(instance.PropertyName.ToString();
- }
Add Comment
Please, Sign In to add comment