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. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Bind to event oninput

Thread ID:

Created:

Updated:

Platform:

Replies:

151016 Jan 28,2020 10:49 AM UTC Jan 29,2020 04:26 PM UTC Blazor 1
loading
Tags: Numeric Textbox
Stefan
Asked On January 28, 2020 10:49 AM UTC

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.




Berly Christopher [Syncfusion]
Replied On 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 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon