I have this on my razor page:
@foreach (AanmeldingItem ai in Aanmeldingen.Aanmeldingen)
{
<NieuweAanmeldingScherm Aanmelding=@ai SL=@SL />
}
The component "NieuweAanmeldingScherm" has a bunch of divs and inputtexts to gather some data. On the same page as the above foreach I have a button to add a new item. When I click this button it adds a new "AanmeldingItem" to "Aanmeldingen.Aanmeldingen" which is a list of "AanmeldingItem".
My problem is that when I enter some data it is not updated to the item in the list.
How does this work in Blazor (I'm just starting with it)?
so basically:
@foreach (MyClass myclass in MyClasses)
{
<MyComponent Myclass=@myclass />
}
MyComponent:
<InputText @bind-value=@myclass.item1 />
<InputText @bind-value=@myclass.item2 />
@code
{
[parameter]
public MyClass myclass {get;set;}
}
Add button on the page containing the foreach loop:
<div class="form-control nieuwAanmeldItem" @onclick="NieuwItem" />
How do I make it so that MyClasses is updated with the info from the inputtexts?