This is a migrated thread and some comments may be shown as answers.

Possible to add .Content with sitemap?

1 Answer 64 Views
Menu
This is a migrated thread and some comments may be shown as answers.
David A.
Top achievements
Rank 1
David A. asked on 18 Dec 2012, 06:22 AM
Hello,

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.

1 Answer, 1 is accepted

Sort by
0
Accepted
Petur Subev
Telerik team
answered on 19 Dec 2012, 05:36 PM
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.
e.g.


@(Html.Kendo().Menu()
      .Name("Menu")
      .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.

i.e.

<?xml version="1.0" encoding="utf-8" ?>
<siteMap>
  <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!
Tags
Menu
Asked by
David A.
Top achievements
Rank 1
Answers by
Petur Subev
Telerik team
Share this question
or