This is really challenging, i want to display three columns in a table,pls see the code iam using MVC and Razor.
here each item is rendered and displayed like this
Item1
Item2
item3
item4
item5
item6
my requirement i have to display it.
Item1 Item2 Item3
Item4 Item5 Item6
on every 3 row an tr should be inserted i guess,pls suggest me an solution sitting with this for two days.
My View:
@foreach(var item in Model.Products)
{
if(i%3==0)
{
}
else
{
}
i += 1;
}

Jaganathan BantheswaranRank #170 · 14.1K reputationPosted Oct 5, 2013, 9:53 PM EDT
Try like this,
@foreach (var product in Model.Products) {
foreach(var item in product.rowItems) {
}
}
Restructure the Products collection
Product = {
rowName = "";
rowItems = new List() { "Item1", "Item2", "item3" }
}
Products = new List() { new Product(), new Product(), ........ }
ashok kumar69 reputationPosted Oct 6, 2013, 9:33 PM EDT
Jaganathan BantheswaranRank #170 · 14.1K reputationPosted Oct 7, 2013, 6:17 AM EDT