Passing Parameter On Focus event


Hi Team,


Can we pass Parameter in Onfocus event. I tried it in sfTextbox but it's giving me an error.


I need something like this




It would be a mess if I put method for each textbox.

Hope you can help me.


Best Regards,

Tyrone





4 Replies

SP Sureshkumar P Syncfusion Team October 10, 2022 11:25 AM UTC

Hi Tyrone,

We suggest you use the native focus event to achieve your requirement.

Find the code example here:

<SfTextBox @ref=TextObj ID="textbox" Placeholder='First Name' @onfocus='@(e => KeyPressed(e, TextObj.ID))'>

</SfTextBox>

 

@code {

    SfTextBox TextObj;

    public void KeyPressed(Microsoft.AspNetCore.Components.Web.FocusEventArgs args, string ID)

    {

       

    }

}


Find the screen shot here:

Find the sample in the attachment:

Note: If this post is helpful, please consider Accepting it as the solution so that other members can locate it more quickly.

Regards,
Sureshkumar P


Attachment: Textbox_894cc08f.zip


TY Tyrone October 12, 2022 02:42 AM UTC

Thanks  Sureshkumar,



SP Sureshkumar P Syncfusion Team October 12, 2022 08:00 AM UTC

Hi Tyrone,


Thanks for your update.


Regards,

Sureshkumar P



LF Loulouka Formula October 12, 2022 10:24 AM UTC

If you want to pass a parameter to the click event handler you need to make use of the arrow function or bind the function.
So more details to contact on my site loulouka Formula

Loader.
Up arrow icon