I am trying to link my own XML file (for some specific purposes that I do not want to use sitemap) to control ASP.NET. I have this code that, with the help of some articles I found, should link the ASP.NET control to the xml file, but that is not the case.
Did 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();
source
share