This is a migrated thread and some comments may be shown as answers.

not able to set focus on treeview, when treeview is inside radpanelbar, specific to IE

2 Answers 79 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
mirang
Top achievements
Rank 1
mirang asked on 13 Apr 2012, 04:57 AM
I am not able to set focus on the treeview when the page loads when the treeview is inside a radpanelbar. Following is the code for the same. I am not sure where I might be going wrong. Can you please guide me through.

 <script language="javascript" type="text/javascript">
        function OnPanelBarClientLoad(sender, args) {
            var panelBar = $find("<%= NavigationPanelBar.ClientID %>");
            var panelItem = panelBar.findItemByText("Browse");
            var treeView = panelItem.findControl("archiveTree");
            treeView._element.focus();
        }
</script>
<telerik:RadPanelBar TabIndex="1" OnClientLoad="OnPanelBarClientLoad" ID="NavigationPanelBar" Style="overflow: auto" runat="server"
            AccessKey="P" ExpandMode="MultipleExpandedItems" Skin="Metro" EnableEmbeddedSkins="false">
            <ExpandAnimation Duration="0" />
            <CollapseAnimation Duration="0" />
            <Items>
                <telerik:RadPanelItem TabIndex="2" Expanded="true" Text="Browse">
                    <Items>
                        <telerik:RadPanelItem>
                            <ItemTemplate>
                                <div>
                                    <telerik:RadTreeView ID="archiveTree" TabIndex="3" runat="server">
                                    <Nodes>
                                        <telerik:RadTreeNode Text="First">
                                            <Nodes>
                                                <telerik:RadTreeNode Text="First First" />
                                            </Nodes>
                                        </telerik:RadTreeNode>
                                    </Nodes>
                                </telerik:RadTreeView>
                                </div>
                            </ItemTemplate>
                        </telerik:RadPanelItem>
                    </Items>
                </telerik:RadPanelItem>
                <telerik:RadPanelItem Expanded="true" TabIndex="4" Text="Browse">
                    <Items>
                        <telerik:RadPanelItem>
                            <ItemTemplate>
                                <div id="archivesPanel">
                                </div>
                            </ItemTemplate>
                        </telerik:RadPanelItem>
                    </Items>
                </telerik:RadPanelItem>
            </Items>
        </telerik:RadPanelBar>

2 Answers, 1 is accepted

Sort by
0
Plamen
Telerik team
answered on 18 Apr 2012, 08:16 AM
Hi Mirang,

 
I will recommend you to focus the div of RadTreeView by using jQuery as in the sample attached.

Hope this will be helpful.

Kind regards,
Plamen Zdravkov
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
mirang
Top achievements
Rank 1
answered on 18 Apr 2012, 09:07 AM
Thanks a lot for the solution. It worked.
Tags
TreeView
Asked by
mirang
Top achievements
Rank 1
Answers by
Plamen
Telerik team
mirang
Top achievements
Rank 1
Share this question
or