If I want to set focus to a RadzenTextBox when a dialog in a CRUD is open, would I set the code OnAfterRenderAsync? I tried this but a label on a Tab within which the textbox exists is getting focus. What am I doing wrong?
If I put the same code within a click event on a button, it's fine!!
To recreate, I created a CRUD page with to fields FirstName & LastName. Without anything specific, when the Add page is displayed, FirstName by default has focus.
If using the OnPreRender, I try and focus the LastName
using, await LastName.Element.FocusAsync();
I can see that when the Add page loads, the LastName for a moment shows the cursor in the LastName and then focus goes to FirstName. So doesn't work as expected.
Now if I enclose the 2 textboxes in a Tab, the tab has focus. Can't get focus on LastName textbox.