Skip to content
Loading
  
  •                             }  
  •                             else  
  •                             {  
  •                                 class="col-md-1">  
  •                                     class="form-control text-center btn-link" style="height:62px;" asp-page="/PTW/PTWView" asp-route-ptwid="@item.PTWMain.PTWId">@Html.DisplayFor(modelItem => item.PTWMain.PTWNo)  
  •                                   
  •                             }  
  •                             class="col-md-11">  
  •                                 class="row no-gutters">  
  •   
  •                                     @if (item.PTWSubsequent != null && item.PTWSubsequent.PTWNoS != 0)  
  •                                     {  
  •                                         @if (User.IsInRole("PTWIsoCert"))  
  •                                         {  
  •                                             class="col-md-2">  
  •                                                 class="form-control text-center btn-link" style="height:62px;" asp-page="/PTW/IsolationCertificate" asp-route-ptwid="@item.PTWId" asp-route-ptwsid="@item.PTWSId">@Html.DisplayFor(model => item.PTWMain.PTWNo) - @Html.DisplayFor(model => item.PTWSubsequent.PTWNoS)  
  •                                               
  •                                         }  
  •                                         else  
  •                                         {  
  •                                             class="col-md-2">  
  •                                                 class="form-control text-center btn-link" style="height:62px;" asp-page="/PTW/PTWView" asp-route-ptwid="@item.PTWId" asp-route-ptwsid="@item.PTWSubsequent.PTWSId">@Html.DisplayFor(modelItem => item.PTWMain.PTWNo) - @Html.DisplayFor(modelItem => item.PTWSubsequent.PTWNoS)  
  •                                               
  •                                         }  
  •                                     }  
  •                                     else  
  •                                     {  
  •                                         class="col-md-2">  
  •                                             "2" readonly class="form-control text-center bg-white" style="resize:none">No Subsequent  
  •                                           
  •                                     }  
  •   
  •                                     class="col-md-2">  
  •                                         "2" readonly class="form-control text-center bg-white" style="resize:none">@Html.DisplayFor(model => item.PTWType)  
  •                                       
  •                                     class="col-md-4">  
  •                                         "2" readonly class="form-control bg-white" style="resize:none">@Html.DisplayFor(model => item.WorkScope)  
  •                                       
  •                                     class="col-md-1">  
  •                                         "2" readonly class="form-control text-center bg-white" style="resize:none">@Html.DisplayFor(model => item.StartDate)  
  •                                       
  •                                     class="col-md-1">  
  •                                         "2" readonly class="form-control text-center bg-white" style="resize:none">@Html.DisplayFor(model => item.EndDate)  
  •                                       
  •                                     class="col-md-2">  
  •                                         "2" readonly class="form-control text-center bg-white" style="resize:none">@Html.DisplayFor(model => item.PTWStatus)  
  •                                       
  •                                   
  •                               
  •                           
  •                     }  
  • but it looks better with grouping 
    0
  • Sachin Singh
    0
    Group means 
     
    so the group result will always need 2 for each , the first foreach to iterate over groups and the second foreach to iterate over items inside a particular group.  In your case, there will be 3 foreach on your page.
    Also, I will never recommend writing a single line of code in view except for the html. All Linq code should be purely in code behind.
    0