/ Published in: C#
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
{ }; var myHtml = html._( body._( ul._( person => li._( a.href("/person/" + person.Id)._( img.src(person.ImageSrc).alt("profile image for " + person.Name) ) ) , people ).RenderIfChildren() ) ); Results in: <html> <body> <ul> <li> <a href="/person/aec76ab4-d5f9-47d7-8b69-698dedc778c3"> <img src="alice.png" alt="profile image for alice"/> </a> </li> <li> <a href="/person/158fe190-f39f-4786-b4e7-c26341176f64"> <img src="bob.jpeg" alt="profile image for Bob"/> </a> </li> <li> <a href="/person/cef84458-ce47-4f5f-a853-643fd23212fe"> <img src="stevo.png" alt="profile image for Steve"/> </a> </li> </ul> </body> </html>