If inside the button

2

I have this "Receive" button, and this checkbox that when checked, means that the account is removed:

IneeditwhenitclicksthebuttonReceive,andthecheckboxisalreadychecked,thatitnotifiesthattheaccounthasalreadybeenreceived,anddoesnotredirectthepage,Thisisthereceivebuttoncode:

<aasp-page="Recebimento" asp-route-id="@item.Id" class="btn btn-sm btn-warning">Receber</a>

How can I make an if within the button?

    
asked by anonymous 05.07.2018 / 15:11

1 answer

2

The most correct thing is to do the logic to create two different buttons:

@if(Model.Quitado){
  <a onclick="alert('Conta já recebida')" class="btn btn-sm btn-warning" disabled>Receber</a>
} else {
  <a asp-page="Recebimento" asp-route-id="@item.Id" class="btn btn-sm btn-warning">Receber</a>
}

Replace the button logic that is best for your application.

    
05.07.2018 / 15:57