This is a migrated thread and some comments may be shown as answers.

Problem with telerik component

1 Answer 76 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Daniel
Top achievements
Rank 1
Daniel asked on 23 Aug 2020, 06:29 PM

    Here is a copy of the component that i built for my form this is the component named "DataTextField"

@inherits EagleCS.ComponentClasses.DataInputTextBase<string>
<div class="form-group">
    <label class="h6">@(TextLabel): </label>
    <TelerikTextBox @bind-Value="@Value"></TelerikTextBox>
    <ValidationMessage For="@ValueExpression"></ValidationMessage>
</div>

 

Here it is inside an EditForm

<DataAnnotationsValidator/>
<DataTextField TextLabel="Name" @bind-Value="screenModel.Name"/>

 

When I click submit for the form even with a value inside it blanks out the text field

and then set the field to be empty.

 

1 Answer, 1 is accepted

Sort by
0
Marin Bratanov
Telerik team
answered on 24 Aug 2020, 09:46 AM

Hi Daniel,

The DataTextField component must expose and raise a ValueChanged event when the field value actually changes, and that usually happens on an input event - like ValueChanged or OnChange, and I see neither in this code. This ValueChanged event allows the @bind-Value syntax and the framework relies on it being raised with the correct new data in order to update the parent view-model.

 

Regards,
Marin Bratanov
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tags
General Discussions
Asked by
Daniel
Top achievements
Rank 1
Answers by
Marin Bratanov
Telerik team
Share this question
or