XpathDocument to XmlDataSource to <asp:menu>
I'm trying to bind the XMLDatasource to a XPATHDocument that I have retrieved from the database.
Does anybody know how to do this? I have tried everything but can't seem to get it right?
I am trying the asp:menu control to an xml that I am pulling straight from the DB
<asp:Menu ID="mnItem" runat="server" DataSourceID="XmlDataSource1">
</asp:Menu>
<asp:XmlDataSource ID="XmlDataSource1" runat="server" XPath="MenuItems/MenuItem"></asp:XmlDataSource>
using (SqlConnection oConn = new SqlConnection(ConfigurationManager.ConnectionStrings["CMS"].ConnectionString))
using (SqlCommand oComm = new SqlCommand("sfspGetPageMenuItems", oConn))
{
oComm.CommandType = CommandType.StoredProcedure;
oConn.Open();
SqlParameter oParam = new SqlParameter("@PageID",SqlDbType.Int);
oParam.Value = 1;
oComm.Parameters.Add(oParam);
XPathDocument xdoc = new XPathDocument(oComm.ExecuteXmlReader());
XmlDataSource1.DataFile = xdoc;
}
Kind Regards,
Gary

