We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

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 06:25 AM

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 11, 2022 09:42 PM

Thanks  Sureshkumar,



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

Hi Tyrone,


Thanks for your update.


Regards,

Sureshkumar P



LF Loulouka Formula October 12, 2022 05:24 AM

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.
Live Chat Icon For mobile
Up arrow icon