@page
"/your-page-name" <h3>Update Data</h3>
<input type="text" @bind-value="Id" />
<input type="text" @bind-value="Field1" required />
<input type="text" @bind-value="Field2" required />
<button class="btn btn-primary" disabled="@HasErrors" @onclick="HandleButtonClick">Update</button>
@if (ErrorMessage != null){ <div class="alert alert-danger">
@ErrorMessage</div>}
@code { private string ErrorMessage { get; set; } private async Task HandleButtonClick() { try { ErrorMessage = null; }
catch (Exception ex) { ErrorMessage = $"An error occurred: {ex.Message}";
}
}
}