|
public class OrderService
{
string baseUrl = "https://localhost:44311/";
public async Task<List<Order>> GetOrdersAsync()
{
HttpClient http = new HttpClient();
throw new System.Exception("Custom Exception thrown from OrderService");
var json = await http.GetStringAsync($"{baseUrl}api/Default");
return JsonConvert.DeserializeObject<List<Order>>(json);
}
} |
|
<span class="error">@ErrorDetails</span>
<SfGrid ID="Grid" TValue="Order">
<GridEvents OnActionFailure="ActionFailure" TValue="Order"></GridEvents>
</SfGrid>
<style>
.error {
color: red;
}
</style>
@code {
public string ErrorDetails = "";
private void ActionFailure(Syncfusion.Blazor.Grids.FailureEventArgs args) {
ErrorDetails= args.Error.Message;
StateHasChanged();
}
} |