In the TelerikForm component, you have "FormItem" with a string parameter of Field and from the string, you somehow bind the data to that field.
For other components, we must use the @bind-Value to get this 2-way binding.
I would like to request the "Field" parameter for more controls like TelerikTextBox where we can bind using the string name of the field like we do in FormItem.
So instead of:
<TelerikTextBox @bind-Value="@customer.CustomerName" />
we would be able to do this:
<TelerikTextBox Field="CustomerName" />
Peter
Okay, I have an alternative solution, perhaps this works already but there is just no documentation for it.
If we expose the contents of the Field inside of a templated FormItem.
Something like this:
<FormItem Field="customer.CustomerName">
<Template>
<label for="country">Customer Name:</label>
<TelerikTextBox @bind-Value="@context.Value" />
</Template>
</FormItem>
That way we could have access to the variable inside the template. It would be a generic solution that would work for all controls just by exposing the target of the FormItem.
Peter
Hello Peter,
The Field parameter is added to components that are meant to be bound to a model or can receive a model through a parameter, such as the TItem for the Grid. Let me provide a short list of components that have the Field parameter:
The TextBox is designed to be bound to a string variable and this is the most common scenario. The Field parameter is useful only when the component is used in a form or a component that has EditContext as you rightfully mentioned. However, it will be a substitute, of a sort, for the @bind-Value mechanism that works in specific scenarios - when an EditContext is present.
Based on that, our belief is that this is best implemented by the application, where our input component (TextBox, NumericTextBox, CheckBox, etc) is wrapped by a custom component that executes the necessary business logic.
That being said, I am marking this feature request as "Declined".
Regards,
Svetoslav Dimitrov
Progress Telerik