Issue
Hello friends I have a problem is that I want to show the return value of a field of the database in the table .. My problem is that it shows all the return values in one head .. I want only 8 numbers in each row Show me and dynamically add another line .. Thank you for your help
</div>
<div role="tabpanel" class="tab-pane fade" id="Tab3">
@if (ViewBag.ProductPartNumber != null)
{
List<ShowProductPartNumberViewModel> list = ViewBag.ProductPartNumber;
<div class="table-responsive">
<table class="table table-striped">
<tbody>
@foreach (var item in list)
{
<tr>
<td>@item.ProductNumberTitle </td>
</tr>
}
</tbody>
</table>
</div>
}
</div>
Solution
Try this:
@for (int i = 0; i < list.Count(); i += 8)
{
var items = list.Skip(i).Take(8).ToList();
System.Text.StringBuilder sb = new System.Text.StringBuilder();
<tr>
<td>
foreach (var item in items)
{
sb.Append(item.ProductNumberTitle)
}
sb.ToString();
</td>
</tr>
}
Answered By - Adlorem
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.