<div style="position:absolute; left:300px; top:633px;">
@using (Html.BeginForm("Delete", null, new { id = Model.BicycleSellerListingId }, FormMethod.Post))
{
if(Model.BicycleSellerListingId < 0){
<button type="submit">Delete Listing</button>
}
}
</div>
OR
@if(Model.BicycleSellerListingId < 0){
<div style="position:absolute; left:300px; top:633px;">
@using (Html.BeginForm("Delete", null, new { id = Model.BicycleSellerListingId }, FormMethod.Post))
{
<button type="submit">Delete Listing</button>
}
</div>
}
OR
<div style="position:absolute; left:300px; top:633px;">
@using (Html.BeginForm("Delete", null, new { id = Model.BicycleSellerListingId }, FormMethod.Post))
{
<button type="submit" @((Model.BicycleSellerListingId < 0) ? "disabled" : "")>Delete Listing</button>
}
</div>
非常に素晴らしく、非常にシンプル。私は思ったよりも簡単です。 – Hosea146