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

How to select the RadTab for a RadPageView that has a specific control

1 Answer 179 Views
TabStrip
This is a migrated thread and some comments may be shown as answers.
Paul
Top achievements
Rank 1
Paul asked on 13 Nov 2013, 08:02 PM

I am trying to implement a solution on a website where some pages have a RadTabStrip (with the MultiPageID set) with multiple tabs (with the PageViewID set).

When navigating to a page you can set the focus be set to a specific control that may be in a RadPageView.  If that is the case what is the best way to select the tab that corresponds to the page view that contains the control?

Basically when focus is set to a control in a RadPageView how do I make sure the rad tab is selected so that control can be seen on the page?

I can find the control on the page that needs focus and then find the parent RadPageView (and RadMultiPage), but I don't know of a good way to select the RadTab that corresponds to the RadPageView (since I don't know the ID of the RadTabStrip). 

Am I forced to recursively search through the controls on to the page to find the RadTabStrip (by type) and then find the tab that has the matching PageViewID?

Thanks!

1 Answer, 1 is accepted

Sort by
0
Boyan Dimitrov
Telerik team
answered on 18 Nov 2013, 05:05 PM
Hello,

Regarding the custom scenario you attempt to implement and the fact that the ID of the RadTabStrip is not know, I suggest that the approach you attempted to implement is the appropriate one - finding the RadTabStrip on the page by its type.

 However, as a slight facility, I would suggest you to use a custom attribute for each PageView, with setting a value associated with the corresponding Tab. Thus, once you find the needed control and the PageView, where it is nested in, you could store the value (suggesting the TabName, which the pageView is associated with) of the custom attribute. Once you find the RadTabStrip on the Page, you could directly use the Selected property of the RadTab, in order to focus it.

<telerik:RadTabStrip ID="rtsNavigation" runat="server"
                    MultiPageID="rmpMainContent" SelectedIndex="0">
                    <Tabs>
                        <telerik:RadTab runat="server" Text="Tab1">
                        </telerik:RadTab>
                        <telerik:RadTab runat="server" Text="Tab2">
                        </telerik:RadTab>
                    </Tabs>
                </telerik:RadTabStrip>
                <telerik:RadMultiPage ID="rmpMainContent" runat="server" >
                    <telerik:RadPageView ID="rpvMainPage1" runat="server" CustomAttribute="Tab1"
                        ContentUrl="Default2.aspx">
                    </telerik:RadPageView>
                    <telerik:RadPageView ID="rpvMainPage3" runat="server" CustomAttribute="Tab2"
                        ContentUrl="Default3.aspx">
                    </telerik:RadPageView>
                </telerik:RadMultiPage>



Regards,
Boyan Dimitrov
Telerik
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 the blog feed now.
Tags
TabStrip
Asked by
Paul
Top achievements
Rank 1
Answers by
Boyan Dimitrov
Telerik team
Share this question
or