We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Bind to event oninput

Hi,
How do I bind to oninput event in EjsNumericTextBox? This works fine in an ordinary input element but not EjsNumericTextBox.
The problem is that when event onchange is called the value has not been updated in the model yet. The value received by the method OnChangeReps() is the old value and not the new updated. 
See the attached image. The code in the image does not work for EjsNumericTextBox.




1 Reply

BC Berly Christopher Syncfusion Team January 29, 2020 04:26 PM UTC

Hi Stefan, 
  
Greetings from Sycfusion support. 
  
We have checked your query and we would like to let you know that “@bind-value:event=”oninput”“ is not supported for Blazor custom components. So, we can achieve your requirement by assigning the argument value to the bounded variable for bind-value in the native input event as mentioned below. 
<p>Numeric Value is: @NumericVal</p> 
<EjsNumericTextBox TValue="object" @bind -Value="@NumericVal" @oninput="@OnInput" @onchange="(e => OnChange(e))"></EjsNumericTextBox> 
 
@code { 
    public object NumericVal { get; set; } = 12; 
    public void OnInput(Microsoft.AspNetCore.Components.ChangeEventArgs args) 
    { 
        this.NumericVal = args.Value; 
    } 
    public void OnChange(Microsoft.AspNetCore.Components.ChangeEventArgs args) 
    { 
        Console.WriteLine("Changed"); 
    } 
} 
 
 
  
Please find the sample from the below link. 
 
Also, while binding the onchange event for the Numeric TextBox component, it's working fine at our end. Also, we have provided the support for change event is valuechange for the NumericTextBox component in Blazor platform. So, you can use it for the application needs as mentioned below. 
 
<EjsNumericTextBox TValue="object"> 
    <NumericTextBoxEvents TValue="object" ValueChange="@OnChange"></NumericTextBoxEvents> 
</EjsNumericTextBox> 
 
@code { 
    public void OnChange(Syncfusion.EJ2.Blazor.Inputs.ChangeEventArgs args) 
    { 
        Console.WriteLine("Change event is triggered"); 
    } 
} 
 
  
Please find the documentation from the below link. 
 
Please check the provided sample and still issue persists, please revert us with issue reproducing sample and product version, Visual Studio preview version details that will help us to check and proceed further. 
 
Regards, 
Berly B.C 


Loader.
Live Chat Icon For mobile
Up arrow icon