Possible to add .Content with sitemap?

2 posts, 1 answers
  1. David A.
    David A. avatar
    126 posts
    Member since:
    Aug 2008

    Posted 18 Dec 2012 Link to this post


    I have a menu that I would like to use content in such as the "Stores" menu option in the example found here.  Basically I want to add HTML markup to a parent menu item.  Is this possible?

    Thank you,
    David A.
  2. Answer
    Petur Subev
    Petur Subev avatar
    1882 posts

    Posted 19 Dec 2012 Link to this post

    Hello David,

    The work-around which you can use is to use the overload which accepts sitemapitem action. There you can set the text to be the actual content and you can set the encoded option to false.

          .BindTo("sample", (item, node) =>
              item.Encoded = false ;
              item.Text = node.Attributes["foo"] == null ? "<h1>test</h1>" : "<h1>" + node.Attributes["foo"].ToString() + "</h1>";

    In the snippet above foo is an attribute in the sitemap xml.


    <?xml version="1.0" encoding="utf-8" ?>
      <siteMapNode title="Home" controller="Home" action="Overview">
        <siteMapNode title="Grid">
          <siteMapNode controller="grid" foo="bar baz" action="index" title="First Look (Razor)" area="razor"/>
          <siteMapNode controller="grid" action="index" title="First Look (ASPX)" area="aspx"/>

    I hope this helps.

    All the best,
    Petur Subev
    the Telerik team
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Back to Top