Using the NavigationControl

Posted by Community Admin on 03-Aug-2018 19:30

Using the NavigationControl

All Replies

Posted by Community Admin on 19-Apr-2011 00:00

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

Posted by Community Admin on 21-Apr-2011 00:00

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

Posted by Community Admin on 22-Apr-2011 00:00

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

This thread is closed