Error in rendering custom component in DxGrid component

35 views Asked by At

In a blazor project I'm using the following DevExpress Blazor component:

<DxTextBox BindValueMode="BindValueMode.OnInput" TextChanged="(string val) => InputChanged(val)" />

When I'm using this component inside the of a DxGrid object, I've the following error:

crit: Microsoft.AspNetCore.Components.WebAssembly.Rendering.WebAssemblyRenderer[100] Unhandled exception rendering component: DevExpress.Blazor.Internal.Editors.Models.TextBoxModel requires a value for the 'TextExpression' property. It is specified automatically when you use two-way binding('bind-Text').

In the following ticket I've read that the issue could be the missing @bind-Text:

https://supportcenter.devexpress.com/ticket/details/t834633/textbox-for-blazor-the-unable-to-set-property-textchanged-on-object-of-type-devexpress

but in my case I'm using TextChanged that already uses the @bind-Text attribute.

2

There are 2 answers

0
Jalpa Panchal On

Could you try below way for DxTextBox component to include two-way binding with the @bind-Text directive while still handling the TextChanged event:

@code {
    private string myText; 

    private void InputChanged(string val)
    {
        // Handle the input change event if necessary
    }
}

<DxTextBox @bind-Text="myText" BindValueMode="BindValueMode.OnInput" TextChanged="InputChanged" />
0
andreasperelli On

Solved in this way:

<DxTextBox @bind-Text="@MyField" @oninput="OnInputHandler" BindValueMode="BindValueMode.OnInput" >