This question is locked. New answers and comments are not allowed.
Hi All,
I'm using the Menu control with the MVCSiteMapProvider. I cannot figure out why the menu is rendering as an unordered list after building and publishing the site. The entire sitemap renders, and the second level nodes are placed as first order nodes in the list.
Here's my _layout.cshtml:
I've wiped out all the pertinent CSS in site.css, which was created as part of the MVC3 solution template.
Here's my HomeController:
How should I modify either the _Layout.cshtml or the HomeController such that the Menu renders in horizontal format with flyout child nodes and is not rendered as an unordered list?
Thanks,
Sid
I'm using the Menu control with the MVCSiteMapProvider. I cannot figure out why the menu is rendering as an unordered list after building and publishing the site. The entire sitemap renders, and the second level nodes are placed as first order nodes in the list.
Here's my _layout.cshtml:
@using MvcSiteMapProvider;
@using Telerik.Web.Mvc.UI;
<!DOCTYPE html>
<
html
>
<
head
>
<
title
>@ViewBag.Title</
title
>
<
link
href
=
"@Url.Content("
~/Content/Site.css")"
rel
=
"stylesheet"
type
=
"text/css"
/>
<
script
src
=
"@Url.Content("
~/Scripts/jquery-1.4.4.min.js")"
type
=
"text/javascript"
></
script
>
@{Html.Telerik().StyleSheetRegistrar()
.DefaultGroup(group => group
.Add("telerik.common.min.css")
.Add("telerik.rtl.min.css")
.Combined(true)
.Compress(true));
}
</
head
>
<
body
>
<
div
class
=
"page"
>
<
div
id
=
"header"
>
<
div
id
=
"title"
>
<
h1
>Welcome to MyDomain.com</
h1
>
</
div
>
<
div
id
=
"logindisplay"
>
@Html.Partial("_LogOnPartial")
</
div
>
<
div
id
=
"menu"
>
@{Html.Telerik().Menu()
.Name("Menu")
.BindTo(Html.MvcSiteMap().Provider.RootNode.ChildNodes,
mappings => mappings.For<
MvcSiteMapNode
>(binding => binding
.ItemDataBound((item, node) =>
{
item.Text = node.Title;
item.ActionName = node.Action;
item.ControllerName = node.Controller;
})
.Children(node => node.ChildNodes)))
.Orientation(MenuOrientation.Horizontal)
.Effects(fx => fx.Slide()
.Opacity()
)
.Render();
}
</
div
>
</
div
>
<
div
id
=
"main"
>
@RenderBody()
<
div
id
=
"footer"
>
</
div
>
</
div
>
</
div
>
@{ Html.Telerik().ScriptRegistrar()
.OnDocumentReady(
@<
text
>
prettyPrint();
</
text
>);
}
</
body
>
</
html
>
I've wiped out all the pertinent CSS in site.css, which was created as part of the MVC3 solution template.
Here's my HomeController:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using MySite.Models;
using Telerik.Web.Mvc;
namespace MySite.Controllers
{
public class HomeController : Controller
{
MySiteEntities _db;
public HomeController()
{
_db = new MySiteEntities();
}
public ActionResult Index()
{
ViewBag.Message = "Welcome to My Site!";
return View();
}
public ActionResult About()
{
return View();
}
public ActionResult Contact()
{
return View();
}
}
public partial class MenuController : Controller
{
[PopulateSiteMap(SiteMapName = "MySiteMap", ViewDataKey = "MySiteMap")]
public ActionResult SiteMapBinding()
{
if (!SiteMapManager.SiteMaps.ContainsKey("Veehco"))
{
SiteMapManager.SiteMaps.Register<
XmlSiteMap
>("MyDomain", sitemap => sitemap.LoadFrom("~/MyDomain.sitemap"));
}
return View();
}
public ActionResult Orientation(string orientation)
{
ViewData["orientation"] = orientation ?? "Vertical";
return View();
}
public ActionResult AnimationEffects(string animation, bool? enableOpacityAnimation, int? openDuration, int? closeDuration)
{
ViewData["animation"] = animation ?? "slide";
ViewData["enableOpacityAnimation"] = enableOpacityAnimation ?? true;
ViewData["openDuration"] = openDuration ?? 200; ViewData["closeDuration"] = closeDuration ?? 200;
return View();
}
}
}
How should I modify either the _Layout.cshtml or the HomeController such that the Menu renders in horizontal format with flyout child nodes and is not rendered as an unordered list?
Thanks,
Sid