Im using Telerik Blazor controls, I am using mt API to return data which works fine when I check it from an API perspective. My web app has issues as it errors as I believe there is no data. To my knowledge this is due to OnInitializedAsync(). Below is my code:
<TelerikScheduler Data="@HolidayPlanners" @bind-Date="@StartDate" @bind-View="@selectedView" Height="100%" Class="Scheduler" OnCreate="@AddAppointment"
OnUpdate="@UpdateAppointment" OnDelete="@DeleteAppointment"
AllowCreate="true" AllowDelete="true" AllowUpdate="true"
IdField="@(nameof(UvwHolidayPlanner.Pk))"
StartField="@(nameof(UvwHolidayPlanner.StartDate))"
EndField="@(nameof(UvwHolidayPlanner.EndDate))"
TitleField="@(nameof(UvwHolidayPlanner.Title))"
DescriptionField="@(nameof(UvwHolidayPlanner.Description))"
IsAllDayField="@(nameof(UvwHolidayPlanner.IsAllDay))"
RecurrenceRuleField="@(nameof(UvwHolidayPlanner.RecurrenceRule))"
RecurrenceExceptionsField="@(nameof(UvwHolidayPlanner.RecurrenceExceptions))"
RecurrenceIdField="@(nameof(UvwHolidayPlanner.RecurrenceFk))">
<SchedulerViews>
<SchedulerMonthView></SchedulerMonthView>
</SchedulerViews>
@code {
public string _URL = String.Empty;
IEnumerable<UvwHolidayPlanner> HolidayPlanners { get; set; }
DateTime StartDate = DateTime.Now;
SchedulerView selectedView { get; set; } = SchedulerView.Month;
protected override async Task OnInitializedAsync()
{
_URL = settingsAccessor.AllClientSettings().BaseServiceURI;
HolidayPlanners = (await http.CreateClient("ClientSettings").GetFromJsonAsync<List<UvwHolidayPlanner>>($"{_URL}/lookup/HolidayPlanner"))
.OrderBy(t => t.Title)
.ToList();
StateHasChanged();
}
//private void LoadData()
//{
//Appointments = appointmentService.GetAppointments();
//}
void UpdateAppointment(SchedulerUpdateEventArgs args)
{
//appointmentService.UpdateAppointment((AppointmentDto)args.Item);
//LoadData();
}
void AddAppointment(SchedulerCreateEventArgs args)
{
//appointmentService.CreateAppointment((AppointmentDto)args.Item);
//LoadData();
}
void DeleteAppointment(SchedulerDeleteEventArgs args)
{
//appointmentService.DeleteAppointment((AppointmentDto)args.Item);
//LoadData();
}
}
My HolidayPlanners property seems to return null & it errors. Unsure if this is because the UI Components have already initialized.
Below is a message within the 404 error unsure if thats an issue:
ProjectManager.Pages.Pages__Host.<ExecuteAsync>b__15_1() in _Host.cshtml
<component type="typeof(App)" render-mode="ServerPrerendered" />
I have tried render-mode="Server" & "Static"