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

RadNavigation URL Link Required for Nodes

3 Answers 161 Views
Navigation
This is a migrated thread and some comments may be shown as answers.
Carol
Top achievements
Rank 1
Carol asked on 04 Oct 2015, 06:56 PM

Using any data source, I can create the necessary hierarchy for a menu system using the RadNavigation.  However, I have no examples or knowledge on how to activate associated URLs for each of the nodes. 
If JavaScript is required, please show by example.

Required Info

  • Visual Studio 2013
  • Windows 10 Pro
  • Google Chrome Version 45.0.2454.101 m 
  • Telerik Product: UI for ASP.NET AJAX, v.2015.3.930.45 (Dev)
  • VB.NET

My HTML

<telerik:RadNavigation runat="server" ID="RadMenu3" Skin="BlackMetroTouch"
    DataSourceID="XmlDataSource1"
    DataTextField="Text"
    DataNavigateUrlField="Url">
</telerik:RadNavigation>
 
 
<asp:XmlDataSource ID="XmlDataSource1" runat="server"    
    DataFile="~/App_Data/SiteNavigation.xml" XPath="/SiteNavigation/Item">
</asp:XmlDataSource>

 

XML SiteNavigation (abbreviated)

<?xml version="1.0" encoding="utf-8" ?>
<SiteNavigation>
  <Item Url="#" Text="Surveying the Past" >
    <Item Url="#" Text="Timeline" />
    <Item Url="#" Text="Blog" />
    <Item Url="#" Text="Discussion" />
  </Item>
  <Item Url="#" Text="Experiencing the Present" >
    <Item Url="#" Text="Timeline" />
    <Item Url="#" Text="Blog" />
    <Item Url="#" Text="Discussion" />
  </Item>
 
</SiteNavigation>

 

ERROR: Page Won't Load

System.Web.UI.WebControls.XmlHierarchyData' does not contain a property with the name 'Url'

 

 

 

3 Answers, 1 is accepted

Sort by
0
Carol
Top achievements
Rank 1
answered on 04 Oct 2015, 07:35 PM

I kept toying around with this and by adding a

Description=""

attribute to each node, in addition to "Url" and "Text", no errors presented and the link activated as required.

0
Carol
Top achievements
Rank 1
answered on 05 Oct 2015, 04:25 PM

Hello, I still need assistance.

When I attempted to duplicate the "Description" attribute solution within a different application, I didn't not achieve the desired result.  When clicking on any root item, drop-down does not occur (although it did in my first test), instead you are taken to a default page, as if the entire navigation bar is a "Home" button hot link.

 All examples demonstrate how to include navigation items, but there is no demonstration of how to make the navigation functional with hyperlinks.

Please provide an example that shows how to activate navigation by using an external XML file and an example of how to extend the Expand on Hover demo (where menu items are included in the JS code) to hyperlink to website content.

 

0
Ivan Danchev
Telerik team
answered on 07 Oct 2015, 01:32 PM
Hello Carol,

The error "...does not contain a property with the name 'Url'" is returned probably due to an item/items in the xml file missing a Url property. Setting the RadNavigation's DataNavigateUrlField will result in all nodes getting their NavigateUrl property values from the source and if the source does not provide such property for a particular node an exception will be thrown.
If you do not want all Navigation nodes to navigate to a page you must still set the corresponding Url property in the xml file and for those who won't have a navigation function, for example root nodes, you can set it like this: Url="#".
As for the expand-on-hover functionality, it will allow you to achieve both: a url you can navigate to when clicking the root node and expand/collapse functionality, that would show/hide on hover the node's child nodes without navigating.
Please, find attached a sample project containing a RadNavigation bound to an XMLDataSource and demonstrating the expand-on-hover functionality.

Regards,
Ivan Danchev
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
Navigation
Asked by
Carol
Top achievements
Rank 1
Answers by
Carol
Top achievements
Rank 1
Ivan Danchev
Telerik team
Share this question
or