Telerik Button Focus

1 Answer 313 Views
Button Form General Discussions
Vishnu
Top achievements
Rank 1
Iron
Veteran
Vishnu asked on 24 Aug 2021, 02:38 PM

Hi

 

Is Focus is available for Telerik Button? 

Could you please suggest on this?

 

Thanks,

Vishnu Vardhanan H

1 Answer, 1 is accepted

Sort by
0
Hristian Stefanov
Telerik team
answered on 27 Aug 2021, 09:40 AM

Hi Vishnu,

You can programmatically focus any specific button using the FocusAsync() method the TelerikButton provides. I have prepared for you an example showing a possible implementation of the functionality:

 

<TelerikButton OnClick="@FocusMyButton">Focus the second button!</TelerikButton>
<br />
<br />
<br />
@result
<br />
<TelerikButton @ref="@button" OnClick="@OnClickHandler">Second button!</TelerikButton>

@code {
    string result;
    string moreInfo;

    TelerikButton button;

    async Task FocusMyButton()
    {
        await button.FocusAsync();
    }

    async Task OnClickHandler(MouseEventArgs args)
    {
        result = "Second Button was clicked at: " + DateTime.Now.ToString();
    }
}

 

You can find more details and examples regarding the FocusAsync() method in the following knowledge base article: Focus TextBox Programmatically.

I hope this helps. Please let me know if you need any further information.

Regards,
Hristian Stefanov
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Tags
Button Form General Discussions
Asked by
Vishnu
Top achievements
Rank 1
Iron
Veteran
Answers by
Hristian Stefanov
Telerik team
Share this question
or