html5 - How to print 2 columns of pictures from a list in asp.net mvc3 -
i have code , bit in doubt how make print 2 rows instead of 1 (later want dynamic depending on screensize if possible, should 2 columns)
@model ienumerable<firstweb.models.picture> @{ viewbag.title = "index"; } <h2>index</h2> <p> @html.actionlink("create new", "create") </p> <table> <tr> <th> title </th> <th> path </th> <th> concertyear </th> <th> title </th> <th> path </th> <th> concertyear </th> </tr> @bool = false; @foreach (var item in model) { <tr> <td> @html.displayfor(modelitem => item.title) </td> <td> <a href=@html.displayfor(modelitem => item.path)><img src=@html.displayfor(modelitem => item.path) width="250px" /> </a> </td> <td> @html.displayfor(modelitem => item.concertyear) </td> </tr> } </table>
so want boolean switch between left , right column
i don't know how can boolean flag left or right, if after 2 columns, (apologies typos/syntax errors, idea).
@for (int = 0; < model.contactmethods.count; += 2) { <tr> <td> @html.displayfor(modelitem => model[i].title) </td> <td> <a href=@html.displayfor(modelitem => model[i].path)> <img src=@html.displayfor(modelitem => model[i].path) width="250px" /> </a> </td> <td> @html.displayfor(modelitem => model[i].concertyear) </td> @if (model.contactmethods.count > + 1) { <td> @html.displayfor(modelitem => model[i + 1].title) </td> <td> <a href=@html.displayfor(modelitem => model[i + 1].path)> <img src=@html.displayfor(modelitem => model[i + 1].path) width="250px" /> </a> </td> <td> @html.displayfor(modelitem => model[i + 1].concertyear) </td> } else { <td colspan="3"></td> } </tr> }
as far dynamic columns, you'll need @ jquery that
Comments
Post a Comment