I found Bind ASP.NET Menu control to XML question helpful in find my problem. Now the problem I am facing is my menu looks like this (even the main menu as expanding menu attached to it. I want it to have a regular drop down. Can I achieve it?

My xmlfile is attached. I tried removing the root tag but than it is not a xml file and it breaks the code.
<?xml version="1.0" encoding="utf-8" ?>
<menu>
<menuItem>
<text>
<img align="middle" src="images/new.gif" width="32"
height="16" /> What's New? <img align="middle"
src="images/right.gif" width="16" height="16" />
</text>
<subMenu>
<menuItem>
<text>&nbsp;&nbsp;&nbsp;New Articles</text>
<url>/suboption1.1.html</url>
</menuItem>
<menuItem>
<text>&nbsp;&nbsp;&nbsp;New FAQs</text>
<commandName>NewFAQ</commandName>
</menuItem>
</subMenu>
</menuItem>
<menuItem>
<text>
<img align="middle" src="images/paw.gif" width="20"
height="16" /> Animal Facts <img align="middle"
src="images/right.gif" width="16" height="16" />
</text>
<url>/option2.html</url>
<subMenu>
<menuItem>
<text>
<![CDATA[<img align="middle" src="images/paw.gif"
width="20" height="16" /> Animal Facts <img
align="middle" src="images/right.gif" width="16"
height="16" />]]>
</text>
<url>/suboption2.1.html</url>
<subMenu>
<menuItem>
<text>Facts about Terriers</text>
<url>/suboption2.1.1</url>
</menuItem>
<menuItem>
<text>Facts about Beagles</text>
<url>/suboption2.1.2</url>
</menuItem>
<menuItem>
<text>Facts about Great Danes</text>
<url>/suboption2.1.3</url>
</menuItem>
<menuItem>
<text>Facts about Poodles</text>
<url>/suboption2.1.4</url>
</menuItem>
</subMenu>
</menuItem>
<menuItem>
<text>
&nbsp;&nbsp;&nbsp;Facts About
Goats
</text>
<url>/suboption2.2.html</url>
</menuItem>
<menuItem>
<text>
&nbsp;&nbsp;&nbsp;Facts About
Snakes
</text>
<url>/suboption3.2.html</url>
</menuItem>
</subMenu>
</menuItem>
<menuItem>
<text>
<img align="middle" src="images/email.gif" width="18"
height="18" /> Contact
</text>
<url>mailto:mitchell@4guysfromrolla.com</url>
</menuItem>
</menu>
Adding Code
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
MainMenu.DataSource = GetSiteMapDataSource("firtmenu.xml");
MainMenu.DataBind();
}
}
private XmlDataSource GetSiteMapDataSource(string siteMapFileName)
{
if (siteMapFileName != string.Empty)
{
XmlDataSource xmlSource = new XmlDataSource();
xmlSource.DataFile = siteMapFileName;
xmlSource.DataBind();
return xmlSource;
}
else
{ return null; }
}
Looks like it is not possible.
Microsoft at this link says, the XML must have a root element and a proper structure of xml with menu,menuitem, and properties.
Further …
I found a similar thread on sitepoint, who asked the same question. The solution there is using XPATH to filter the result. In my example case, you will use
It does filter the XML but it produces more problems. That is
Looks like another poor implementation of Microsoft. It is rather not an implementation but just a bogus do this and that and then result, there is not result.