Blazor TextBox focus events

Hi!

Is there a way to handle a focus lost event for a TextBox? I want to call a C# function when the user clicks out of the textbox (when the textbox loses focus).

Thanks for the answer.

3 Replies 1 reply marked as answer

VS Vignesh Srinivasan Syncfusion Team February 15, 2021 02:19 PM UTC

Hello Kristóf, 
 
Greatings from Syncfusion support, 
 
We have looked into your query and came up with a solution (i.e) you can handle using the “Blur Event” when the textbox loses its focus. Please find the code snippet below for reference. 
 
   <div class="form-group"> 
        <SfTextBox ID='textbox' CssClass="e-outline" Blur="onBlur" Width="250px" Placeholder="Description *" FloatLabelType="FloatLabelType.Always"></SfTextBox>  
    </div> 
 
 
 
@code {  
    void onBlur() 
    { 
        Console.WriteLine("Focus Lost... !!"); 
    } 
 
} 
 
 
 
Kindly check the attached sample and revert us if you have more queries regarding this. 
 
 
Regards, 
 
Vignesh Srinivasan. 


Marked as answer

KR Kristof February 15, 2021 02:59 PM UTC

Thank you!


BC Berly Christopher Syncfusion Team February 16, 2021 06:55 AM UTC

Hi Kristóf, 
  
Most welcome. Please let us know If you need further assistance on this. 
  
Regards, 
Berly B.C 


Loader.
Up arrow icon