TelerikForm FormItem focus

1 Answer 154 Views
TextArea
Louis
Top achievements
Rank 1
Iron
Iron
Iron
Louis asked on 31 Oct 2022, 10:43 PM

Hello,

How I can put the focus via the code to FormItem  in a TelerikForm ?

1 Answer, 1 is accepted

Sort by
0
Nadezhda Tacheva
Telerik team
answered on 03 Nov 2022, 01:21 PM

Hi Louis,

The editors that the Form uses are essentially integrated UI for Blazor input components (TextBox, NumericTextBox, DatePicker, and more). They all expose FocusAsync method that lets you focus them programmatically.

To focus the desired FormItem with code, use a FormItem Template, render the desired editor component and invoke its FocusAsync() when needed. For example: https://blazorrepl.telerik.com/ccbbuHPn20wid3BZ06.

I hope you will find the above information and sample useful to move forward with your application. Please let us know if any other questions are raised.

Regards,
Nadezhda Tacheva
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Louis
Top achievements
Rank 1
Iron
Iron
Iron
commented on 03 Nov 2022, 04:08 PM

Thanks a LOT
Louis
Top achievements
Rank 1
Iron
Iron
Iron
commented on 04 Nov 2022, 03:01 AM

Someone maybe interested. I have to call the focus in this event

 

       protected override async Task OnAfterRenderAsync(bool firstRender)
        {
            await InterneIdRef.FocusAsync();
        }
Tags
TextArea
Asked by
Louis
Top achievements
Rank 1
Iron
Iron
Iron
Answers by
Nadezhda Tacheva
Telerik team
Share this question
or