Hi, I'm trying to bind my own xml file (for some certain purposes i don't want to use a sitemap) to ASP.NET control. I have this code which - with help of some articles I have found - should bind ASP.NET Menu control to xml file, but it doesn't.
Do I miss something?
XmlDataSource xmlSource = new XmlDataSource();
xmlSource.DataFile = ResolveUrl("~/menu.xml");
xmlSource.XPath = @"/menu/Items/menuItem";
xmlSource.DataBind();
MenuItemBinding binding = new MenuItemBinding();
binding.DataMember = "menuItem";
binding.NavigateUrlField = "NavigateUrl";
binding.TextField = "Text";
Menu1.DataSource = xmlSource;
Menu1.DataBindings.Add(binding);
Menu1.DataBind();