I have a text type input field in my Blazor server app. With the "onchange" event, a function is executed. The value of the input string is transfered to the "data" variable.
I have also a disconnect button. When I press the disconnect button The data variable will be cleared. But I want also that the input field is cleared. But the last entered string remains in the input field. How can I clear it with the disconnect button?
<p>data: @data</p>
<button @onclick="Func_Disconnect">Disconnect</button>
<input type="text" @onchange="Eval_input">
@code {
private string data { get; set; }
private void Eval_input(ChangeEventArgs e)
{
data = (string)e.Value;
// some code that evaluates data variable
}
private void Func_Disconnect()
{
// some code
data="";
}
}