Reputation: 1003
So I have the following model class:
public class Release
{
public int Id { get; set; }
public string Name { get; set; }
public DateTime StartDate { get; set; }
public DateTime EndDate { get; set; }
public string OwnerId { get; set; }
public string OwnerName { get; set; }
public bool Finished { get; set; }
public bool InProgress { get; set; }
public bool Aborted { get; set; }
}
Which will be visualized like this:
I want to hide and show the Start
, Stop
and Finish
buttons, depending on certain values. For example:
If Finished
is true
, all buttons will be hidden.
If InProgress
is true
, Stop
and Finish
buttons will be visible and the other one will be hidden.
If Aborted
is true
, Start
will be visible while Stop
and Finish
will be hidden.
I am quite a beginner when it comes to the UI part so I couldn't figure a way to do this. Below is the code for the 3 columns containing the buttons I talked about.
<td><a class="btn btn-sm btn-primary" asp-action="InProgress" asp-route-id="@p.Id">Start</a></td>
<td><a class="btn btn-sm btn-primary" asp-action="Abort" asp-route-id="@p.Id">Stop</a></td>
<td><a class="btn btn-sm btn-primary" asp-action="Finish" asp-route-id="@p.Id">Finish</a></td>
What should I do in order to achieve this?
Upvotes: 0
Views: 226
Reputation: 807
you can add if statement lke this:
@if (p.InProgress == true)
{
<td><a class="btn btn-sm btn-primary" asp-action="InProgress" asp-route-
id="@p.Id">Start</a></td>
}
Upvotes: 2