Disable the action button

This commit is contained in:
Hisham Bin Ateya 2020-02-15 09:32:31 +03:00
parent ece378c54f
commit d0e03ecbe2
2 changed files with 14 additions and 4 deletions

View File

@ -20,7 +20,7 @@ else
</Header> </Header>
<Row> <Row>
<td><ActionLink Action="Edit" Parameters="@($"id=" + context.AliasId.ToString())" /></td> <td><ActionLink Action="Edit" Parameters="@($"id=" + context.AliasId.ToString())" /></td>
<td><ActionDialog Header="Delete Site" Message="@("Are You Sure You Wish To Delete The " + context.Name + " Site?")" Action="Delete" Security="SecurityAccessLevel.Host" Class="btn btn-danger" OnClick="@(async () => await DeleteSite(context))" /></td> <td><ActionDialog Header="Delete Site" Message="@("Are You Sure You Wish To Delete The " + context.Name + " Site?")" Action="Delete" Security="SecurityAccessLevel.Host" Class="btn btn-danger" OnClick="@(async () => await DeleteSite(context))" Disabled="sites.Count == 1" /></td>
<td><a href="@(scheme + context.Name)">@context.Name</a></td> <td><a href="@(scheme + context.Name)">@context.Name</a></td>
</Row> </Row>
</Pager> </Pager>

View File

@ -27,9 +27,16 @@
</div> </div>
} }
@if (authorized) @if (authorized)
{
if (Disabled)
{
<button class="@Class" disabled @onclick="DisplayModal">@Text</button>
}
else
{ {
<button class="@Class" @onclick="DisplayModal">@Text</button> <button class="@Class" @onclick="DisplayModal">@Text</button>
} }
}
@code { @code {
[Parameter] [Parameter]
@ -50,6 +57,9 @@
[Parameter] [Parameter]
public string Class { get; set; } // optional public string Class { get; set; } // optional
[Parameter]
public bool Disabled { get; set; } // optional
[Parameter] [Parameter]
public string EditMode { get; set; } // optional - specifies if a user must be in edit mode to see the action - default is true public string EditMode { get; set; } // optional - specifies if a user must be in edit mode to see the action - default is true