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

Binding to an MVC Sitemap

7 Answers 73 Views
TabStrip
This is a migrated thread and some comments may be shown as answers.
DominionZA
Top achievements
Rank 1
DominionZA asked on 17 Oct 2013, 04:20 PM
Hi am trying to bind my sitemap to the KendoUI Tabstrip. I am having no joy with the MVC Sitemap though.

If I rename the nodes in my .sitemap from mvcSiteMapNode to siteMapNode then all works. When I change it back to mvcSiteMapNode it won't work. Nothing renders on the page.

What is the correct way to do this?

7 Answers, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 21 Oct 2013, 10:20 AM
Hello,

The nodes should be named "siteMapNode" and using a different name is not support. The only option to change the name and use the built-in sitemap binding is to modify the source code(XmlSiteMap class, SiteMapNodeName property).

Regards,
Daniel
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
DominionZA
Top achievements
Rank 1
answered on 21 Oct 2013, 01:49 PM
This does not work for me. I am using MVCSiteMapProvider so I have nice tight integration between my SiteMap and MVC framework.
So you saying I can't use it because Kendo won't integrate too?

How then can I manually construct my menu based on the sitemap file and mvcSiteMap nodes? I don't mind if I have to do this. I just don't want to have to give up using MVCSiteMapProvider because your menu's and tabs don't support it.
0
Accepted
Daniel
Telerik team
answered on 23 Oct 2013, 11:57 AM
Hello again,

In that case, you will need to create a collection of objects from the sitemap file and bind them to the menu as described in this documentation topic. I attached a sample project that demonstrates this scenario.

Regards,
Daniel
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
DominionZA
Top achievements
Rank 1
answered on 23 Oct 2013, 03:24 PM
Thanks Daniel. Will try your suggestion out and see how it goes.
0
DominionZA
Top achievements
Rank 1
answered on 23 Oct 2013, 05:15 PM
Thank-you Daniel. I am up and running with your suggestion.
0
DominionZA
Top achievements
Rank 1
answered on 23 Oct 2013, 05:40 PM
While on this topic Daniel, please help me to bind the same model from above to your TabStrip.
We will only ever go one level deep, so a TabStrip may look nicer for this.

I can get the tabs to bind and show text etc.. but cannot get the content for each tab based on the sitemap children.
0
Daniel
Telerik team
answered on 25 Oct 2013, 08:34 AM
Hello,

You can set the content of the node to the TabStripItem Html property:

Html.Kendo().TabStrip()
    .Name("tabstrip")
    .BindTo(Model, (item, node) =>
    {
        item.Text = node.Title;
        if (!string.IsNullOrEmpty(node.Html))
        {
            item.Html = node.Html;
        }
        else
        {
            item.ActionName = node.Action;
            item.ControllerName = node.Controller;  
        }
    })
Regards,
Daniel
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
TabStrip
Asked by
DominionZA
Top achievements
Rank 1
Answers by
Daniel
Telerik team
DominionZA
Top achievements
Rank 1
Share this question
or