|
@using Syncfusion.Blazor.Inputs;
<SfTextBox @bind-Value="text" @onkeypress="KeyPressed"></SfTextBox>
@code{
private string text;
public void KeyPressed(KeyboardEventArgs e)
{
text = e.Key;
Console.WriteLine("Text is:" + text);
}
}
|
|
EditForm Model="@exampleModel">
<DataAnnotationsValidator />
<ValidationSummary />
<InputText id="name" @bind-Value="exampleModel.Name" @onkeypress="KeyPressed" />
<button type="submit">Submit</button>
</EditForm>
<SfTextBox @bind-Value="text" @onkeypress="KeyPressed"></SfTextBox>
@code{
private string text;
public void KeyPressed(KeyboardEventArgs e)
{
text = e.Key;
Console.WriteLine("Text is:" + text);
Console.WriteLine("Text is:" + exampleModel.Name);
}
private ExampleModel exampleModel = new ExampleModel();
public class ExampleModel
{
public string Name { get; set; }
}
}
|