views:

82

answers:

1
    XElement xml = new XElement("contacts",
            from c in db.Categories
            orderby c.CategoryID
            select new XElement("contact",
                      new XAttribute("contactId", c.CategoryID),
                      new XElement("firstName", c.CategoryName),
                      new XElement("lastName", c.Description))
            );


    // Saving to a file, you can also save to streams
    xml.Save(@"C:\contacts.xml");

<dxm:ASPxMenu ID="ASPxMenu1" runat="server">
    </dxm:ASPxMenu>

Using the above syntax i can save table value in XML format.But i can not bind this value to *AspxMenu*bellow syntax show error.

  ASPxMenu1.DataSource = xml;
    ASPxMenu1.DataBind(); 

I try to save datavalue in xml format in specific location ,Then want to bind AspxMenu with this file value value.

After run the code C drive contain file named contacts.xml . I want to bind menu by this file.*Help me to bind.*HOw to bind AspxMenu by .xml file value

A: 

Hi,

We have explained how to bind an ASPxMenu to an XMLDataSource in the following video:

http://tv.devexpress.com/#ASPxMenuBindXMLDataSource.movie

I hope, it will be helpful to you. In short, you should not only set the ASPxMenu's DataSourceID property, but also map item's Text, Image, Url, Name properties to the corresponding attributes in an xml node. This can be done by setting the ASPxMenu.TextField, ASPxMenu.ImageUrlField, ASPxMenu.NavigateUrlField and ASPxMenu.NameField properties. You can also read about these properties in our documentation available at:

http://documentation.devexpress.com

DevExpress Team