开发者

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

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜