1-888-365-2779
+1-888-365-2779
Try Now
More in this section

Forums / General Discussions / Using the NavigationControl

Using the NavigationControl

3 posts, 0 answered
  1. Chris Bryant
    Chris Bryant avatar
    33 posts
    Registered:
    07 Jul 2009
    19 Apr 2011
    Link to this post
    Hi,

    I'm attempting to create a WebUserControl that renders my navigation.  For this, I'm using the following code:

    <%@ Register Assembly="Telerik.Sitefinity" Namespace="Telerik.Sitefinity.Web.UI.NavigationControls" TagPrefix="nav" %>
     
    <nav:NavigationControl runat="server" ID="navcontrol1" NavigationMode="VerticalTree" NavigationAction="OnClick" SelectionMode="SelectedPages"></nav:NavigationControl>

    However, nothing is being displayed.  Is there an attribute I'm missing in order for this to display all TopLevel navigation items?

    Also, is there documentation on all Telerik.Sitefinity.Web.UI controls?  Having attribute definition and sample code for each would be a huge help.

    Thanks
  2. Chris Bryant
    Chris Bryant avatar
    33 posts
    Registered:
    07 Jul 2009
    21 Apr 2011
    Link to this post
    Any ideas on this issue?  Worst case, I can build my own navigation using the API, but I'd like to avoid doing that if at all possible.

    thanks
  3. Boyan Barnev
    Boyan Barnev avatar
    1429 posts
    Registered:
    28 Aug 2017
    22 Apr 2011
    Link to this post
    Hello Chris,

    It's not a problem at all to use the built-in Navigation on a page. The reason why you're not seeing any pages is because you have set SelectionMode="SelectedPages" and the Navigation control is expecting you to define the pages you want it to display in the code behind. That's a tough one, though - you have to pass them in a deserialized object format, for example:

    [{"__type":"Telerik.Sitefinity.Web.UI.NavigationControls.SelectedPage","Title":"FirstPage","Id":"51993226-0196-436b-99c4-dc858a860634","Url":null,"IsExternal":false},{"__type":"Telerik.Sitefinity.Web.UI.NavigationControls.SelectedPage","Title":"IndexChanged","Id":"c6cd70f7-b38e-4535-86ce-257a5ba6c253","Url":null,"IsExternal":false}]

    If you can get the Id of your page, you can easily get the other necessary components to pass this to the CustomSelectedPages like this:
    protected void Page_Load(object sender, EventArgs e)
            {
                    
                var myvalue = "[{\"__type\":\"Telerik.Sitefinity.Web.UI.NavigationControls.SelectedPage\",\"Title\":\"FirstPage\",\"Id\":\"51993226-0196-436b-99c4-dc858a860634\",\"Url\":null,\"IsExternal\":false},{\"__type\":\"Telerik.Sitefinity.Web.UI.NavigationControls.SelectedPage\",\"Title\":\"IndexChanged\",\"Id\":\"c6cd70f7-b38e-4535-86ce-257a5ba6c253\",\"Url\":null,\"IsExternal\":false}]";
                this.CustomSelectedPages = myvalue;
                
            }
    Please have in mind that if you want to include all the pages for your Navigation, you can simply omit the SelectionMode="" in your markup, and by default all pages will be shown.
    If you need any further assistance on this matter, please do not hesitate to contact me again.

    Best wishes,
    Boyan Barnev
    the Telerik team

3 posts, 0 answered