I'm a bit stumped here because I do have the parameter attribute applied. I seem to be simply following the documentation in a one to one fashion.
Error message
Unhandled exception rendering component: Object of type 'Onero.Client.Features.CourseManager.CourseModelRegister' has a property matching the name 'HighSchoolRegistrationModelId', but it does not have [ParameterAttribute] applied.
Component hierarchy
//parent
<CascadingValue Value="HighSchoolRegistrationModelId">
<CourseModelAddForm></CourseModelAddForm>
</CascadingValue>
@code {
public long HighSchoolRegistrationModelId;
protected override async Task OnInitializedAsync()
{
await base.OnInitializedAsync();
HighSchoolRegistrationModelId = await CourseService.GetHighSchool();
}
}
//middle component
@if (add)
{
<CourseModelRegister HighSchoolRegistrationModelId="@HighSchoolRegistrationModelId">
</CourseModelRegister>
}
@code {
[CascadingParameter]
protected long HighSchoolRegistrationModelId { get; set; }
private bool add = false;
protected override async Task OnParametersSetAsync()
{
await base.OnParametersSetAsync();
}
private void ShowAddForm()
{
add = true;
}
}
//Grandchild where error occurs
@code {
[CascadingParameter]
protected long HighSchoolRegistrationModelId { get; set; }
// rest of code omitted
}
Am I missing something? Perhaps this has to do with lifecycle management? I tried using OnInitialized as well as OnParametersSet.
Parameterand it worked well enough.