SelectedIndex based on folder name

5 posts, 0 answers
  1. stevied
    stevied avatar
    37 posts
    Member since:
    Apr 2007

    Posted 07 Jul 2009 Link to this post

    I have my tabstrip wokring well as a control within my site but my site has a sub folder and when in that sub folder i want change the selected index to the correct index (in this case 1) but it remains as 0.

    I have tried the following

    Partial Class usercontrols_mainNav 
        Inherits System.Web.UI.UserControl 
        Private Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load 
     
            If System.IO.Path.GetDirectoryName(HttpContext.Current.Request.FilePath).ToLower = "score_selector/Default.aspx" Then 
                RadTabStrip1.SelectedIndex = 1 
            Else 
                RadTabStrip1.SelectedIndex = 0 
            End If 
     
        End Sub 
    End Class 

    But this does not seem to have any effect, any ideas?

    Regards,

    S
  2. Paul
    Admin
    Paul avatar
    4281 posts

    Posted 07 Jul 2009 Link to this post

    Hi stevied,

    Please refer to our TabStrip / Site Navigation example that shows the needed approach.

    Regards,
    Paul
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. stevied
    stevied avatar
    37 posts
    Member since:
    Apr 2007

    Posted 07 Jul 2009 Link to this post

    Hi Paul,

    Thanks for the quick reponse I am not getting the following error

    Server Error in '/cbfootball2009' Application.

    Object reference not set to an instance of an object.

    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

    Source Error:

    Line 12:         If Not IsNothing(tab) Then
    Line 13:             tab.SelectParents()
    Line 14:             tab.PageView.Selected = True
    Line 15:         End If
    Line 16:

    My ascx page looks like this..

    <div id="tabNav"
                <telerik:RadTabStrip ID="RadTabStrip1" runat="server" 
                    Skin="" EnableEmbeddedSkins="False" SelectedIndex="0"
                    <Tabs> 
                        <telerik:RadTab runat="server" Selected="True" SelectedIndex="1"  
                            Text="cbfootball.co.uk" CssClass="cbTab"  SelectedCssClass="cbSelected" 
                            HoveredCssClass="cbHovered" ChildGroupCssClass="cbChildTab"  
                            NavigateUrl="~/default.aspx" > 
                            <Tabs> 
                                <telerik:RadTab runat="server" Text="News" CssClass="first"
                                </telerik:RadTab> 
                                <telerik:RadTab runat="server" Text="Community" Selected="True"
                                </telerik:RadTab> 
                                <telerik:RadTab runat="server" Text="Awards"
                                </telerik:RadTab> 
                                <telerik:RadTab runat="server" Text="Competitions"
                                </telerik:RadTab> 
                                <telerik:RadTab runat="server" Text="Activity"
                                </telerik:RadTab> 
                                <telerik:RadTab runat="server" Text="Predictions"
                                </telerik:RadTab> 
                                <telerik:RadTab runat="server" Text="Under 19s"
                                </telerik:RadTab> 
                                <telerik:RadTab runat="server" Text="Charity"
                                </telerik:RadTab> 
                                <telerik:RadTab runat="server" Text="Contact" CssClass="tabLast" NavigateUrl="~/contact_cbfootball.aspx"  
                                    Selected="True"
                                </telerik:RadTab> 
                            </Tabs> 
                        </telerik:RadTab> 
                        <telerik:RadTab runat="server" Text="Score Selector" 
                            Width="240px" CssClass="ssTab"  SelectedCssClass="ssSelected" SelectedIndex="0" 
                            HoveredCssClass="ssHovered" ChildGroupCssClass="ssChildTab"  
                            NavigateUrl="~/score_selector/Default.aspx" > 
                            <Tabs> 
                                <telerik:RadTab runat="server" Text="Make predictions" CssClass="first"
                                </telerik:RadTab> 
                                <telerik:RadTab runat="server" Text="My results"
                                </telerik:RadTab> 
                                <telerik:RadTab runat="server" Text="mini leagues"
                                </telerik:RadTab> 
                                <telerik:RadTab runat="server" Text="create leagues"
                                </telerik:RadTab> 
                                <telerik:RadTab runat="server" Text="invite friend"
                                </telerik:RadTab> 
                                <telerik:RadTab runat="server" Text="prizes"
                                </telerik:RadTab> 
                                <telerik:RadTab runat="server" Text="T &amp; C's"
                                </telerik:RadTab> 
                            </Tabs> 
                        </telerik:RadTab> 
                    </Tabs> 
                </telerik:RadTabStrip> 
            </div> 

    Am i sill missing something?

    Regards,

    S






  5. Paul
    Admin
    Paul avatar
    4281 posts

    Posted 07 Jul 2009 Link to this post

    Hello stevied,

    As you are not using RadMultiPage control, you can simply remove that line from your code (tab.PageView.Selected = True).

    Regards,
    Paul
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  6. stevied
    stevied avatar
    37 posts
    Member since:
    Apr 2007

    Posted 07 Jul 2009 Link to this post

    Paul many thanks for your help on this, all sorted.

    Regards,

    Stephen
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017