开发者

How to bind an xml sitemap string to asp:menu in ASP.NET

开发者 https://www.devze.com 2022-12-21 18:56 出处:网络
In my ASP.NET Page_load I have this code: SiteMenu.DataSource = new XmlDataSource(); ((XmlDataSource)SiteMenu.DataSource).ID = \"menu\";

In my ASP.NET Page_load I have this code:

  SiteMenu.DataSource = new XmlDataSource();
  ((XmlDataSource)SiteMenu.DataSource).ID = "menu";
  ((XmlDataSource)Si开发者_如何学PythonteMenu.DataSource).Data = "<?xml version=\"1.0\" encoding=\"utf-8\" ?><siteMap>   <siteMapNode title=\"default\" description=\"my title\"  url=\"http://www.google.com\"/></siteMap>";
  SiteMenu.DataBind();

Where SiteMenu is an Asp:menu control. But for some reason I'm getting a menu with one element with name "siteMap" and a child element with name "siteMapNode".

I would like to have only one element (rappresented by the ) with title "default". Any Idea of what I'm doing wrong?

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号