Posts

Showing posts from June, 2013

Umbraco Razor, Dealing with the Issue of state in Forms

Solution: <select name="fr" style=""> <option value="All">All Regions</option> <option value="North" @if (region=="North"){@Html.Raw("selected")}>North</option>   <option value="East" @if (region=="East"){@Html.Raw("selected")}>East</option> <option value="South East" @if (region=="South East"){@Html.Raw("selected")}>South East</option> <option value="West" @if (region=="West"){@Html.Raw("selected")}>West</option> </select>

Umbraco Razor Macro - Write out a Meta Data Title Automatically with page names

@inherits umbraco.MacroEngines.DynamicNodeContext @if (@Model.pageTitle == "")  // where pageTitle is a field name in  your doctype { if (@Model.Id != 1062) // where 1062 is the id of the home page { @Html.Raw("My Web Site Name | ") foreach (var page in Model.Ancestors().OrderBy("Level")) { if (@page.Id != 1062) { @page.Name @Html.Raw(" | "); } } if (@Model.Id != 1062) { @Model.Name } } } else { @Model.pageTitle }