Skip to content
Loading
Razor View if condition within foreach group to show either an a link  
  •                             }  
  •                             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