用一把umbraco嗨7 ASP.NET C#MVC 4一把umbraco 7:獲取屬性值
我試着去使用新的一把umbraco,至今其一直不錯,但我需要得到之一的屬性我我設置的頁面。
@inherits Umbraco.Web.Mvc.UmbracoTemplatePage
@{
var homePage = CurrentPage.AncestorsOrSelf(1).First();
var menuItems = homePage.Children.Where("isMenu == true");
}
<!-- Nav -->
<div class="row">
<div class="col-md-12 top-menu-container">
<ul>
@* If the Url of the current page is "/" then we want to add the class "current_page_item" *@
@* Otherwise, we set the class to null, that way it will not even be added to the <li> element *@
<li>
<div onclick="location.href='/';" class="col-md-2 metro-container" style="background-color:#@Model.Content.GetPropertyValue("navigationColor")" >
<img class="menu-img" src="../../media/1001/home.png" alt="" />
Home
</div>
</li>
@foreach (var item in menuItems)
{
@* If the Id of the item is the same as the Id of the current page then we want to add the class "current_page_item" *@
@* Otherwise, we set the class to null, that way it will not even be added to the <li> element *@
<li>
<div onclick="location.href='@item.Url';" class="col-md-2 metro-container" style="background-color:#@item.Content.GetPropertyValue("navigationColor")" >
<img class="menu-img" src="../../media/1001/home.png" alt="" />
@item.Name
</div>
</li>
}
</ul>
</div>
</div>
所以第一個「禮」外循環,我只是得到了模型的內容getProperty方法這肯定足以讓我的財產我告訴它了。
但是,我的循環雖然經歷了當前網頁的兒童,我似乎無法得到一個特定的屬性。
使情況變得更糟是不是所有運行時都在工作。
有問題的行是
<div onclick="location.href='@item.Url';" class="col-md-2 metro-container" style="background-color:#@item.Content.GetPropertyValue("navigationColor")" >
我需要獲得從navigationColor控制在頁面上設置的顏色。
我在這裏做錯了什麼?