reset Value to null

Hi, 

I have this code in my project:

<SfNumericTextBox TValue="int?" Value="IntValue"></SfNumericTextBox>

<SfButton @onclick="ResetIntValue">Reset</SfButton>

@code {

public int? IntValue {get;set;}

    public void ResetIntValue ()

    {

         IntValue  = null;

    }

}

After pressing the button, the textbox did not clear, it keeps the value.

If I set the calue to a number instead of null, everything works as expected.


Are I am doing something wrong here?


1 Reply

PK Priyanka Karthikeyan Syncfusion Team March 26, 2024 05:55 AM UTC

Hi Alexander Kuhlmann,

Greetings from Syncfusion Support.

We suggest binding the bind-Value property to address this issue. Please find the code snippet and sample for your reference.

<SfNumericTextBox TValue="int?" @bind-Value="IntValue"></SfNumericTextBox>

<SfButton @onclick="ResetIntValue">Reset</SfButton>


Samplehttps://blazorplayground.syncfusion.com/VthTDgrRhsrmZeIg

Regards,

Priyanka K


Loader.
Up arrow icon