TabStrip - set the focus() and/or tabindex to a specific element in the partial view - when tab is selected

1 Answer 13 Views
TabStrip
Jonathan
Top achievements
Rank 1
Iron
Veteran
Jonathan asked on 06 May 2024, 04:07 PM

I have a Kendo tabstrip with partial views. When I click on the tab, the partial views are loaded. But I need to set the focus() and/or tabindex to a specific element in the partial view, for example the first text box. I tried setting the tabindex to 1 in the partial view. But that does Not seem to work.

There seems to be 2 TabStrip methods for loading a partial views ?

.LoadContentFrom("CustomerEdit"... and .Content(@<text> @Html.Partial("OrdersEdit"

I think the LoadContentFrom is Ajax.

Using Content(@<text> @Html.Partial("OrdersEdit"**... how can I set the focus to my first textbox on the the OrdersEdit.. I tried setting tabindex =1 and tried this:

 $(document).ready(function () {
    $('#firstTextBox').focus();
}

But does not work.

1 Answer, 1 is accepted

Sort by
0
Anton Mironov
Telerik team
answered on 09 May 2024, 08:55 AM

Hello Jonathan,

Thank you for the details provided.

Yes, you are totally correct - the LoadContentFrom is Ajax.

In order to achieve the desired behavior, I would recommend using a moment to focusing an element when it is available in the DOM tree.

This moment could be the "ContentLoad" Event of the TabStrip.

Feel free to choose from the available events of the Component:

Give a try to the approach above. If additional assistance is needed - send me a runnable sample of your application, a REPL, or a dojo example and I will try my best to achieve the desired result.

 

Kind Regards,
Anton Mironov
Progress Telerik

Stay tuned by visiting our public roadmap and feedback portal pages. If you're new to the Telerik family, be sure to check out our getting started resources, as well as the only REPL playground for creating, saving, running, and sharing server-side code.

Tags
TabStrip
Asked by
Jonathan
Top achievements
Rank 1
Iron
Veteran
Answers by
Anton Mironov
Telerik team
Share this question
or