I'm trying to generate forms with Blazor programatically, and I'm running into an issue where I need to bind an InputText value to a memeber of a collection such as:
@foreach (var prop in formProperties)
{
<InputText [email protected] @bind-Value="form.Responses[prop.Name]" />
}
However, I get the following exception:
System.ArgumentException: The provided expression contains a InstanceMethodCallExpression1 which is not supported. FieldIdentifier only supports simple member accessors (fields, properties) of an object.
Is it possible to bind input to a collection of some sort?
formProperties. Then create a child component that takesprop. The parent component foreach's through the collection and renders a child component for eachprop. The child component can then handle the rendering of the correct<InputText>fields for each property of prop and bind them. - Dennis v. W.<InputText>fields be binded to? And how could I get that data to the parent? - AdamChangedyou can notify the parent on updates. - Dennis v. W.