Umbraco Razor, Fill in a Dropdownlist or Mega drop down from DataTypes using a Function

@using Examine
@using Examine.SearchCriteria
@using UmbracoExamine
@using System.Xml.XPath

@helper fillDropDown(int thisPreValue, string thisLocation)
{XPathNodeIterator preValueRootElementIterator = umbraco.library.GetPreValues(thisPreValue);
  XPathNodeIterator preValueIterator = preValueRootElementIterator.Current.SelectChildren("preValue", "");
<div class="col_4 responsive_thirds">

  @Html.Raw("<li><strong><a href=\"#selectionmenu?location=" + @thisLocation + "\">" + @thisLocation + "</strong></li>")
  @while (preValueIterator.MoveNext())

   @Html.Raw("<a href=\"#selectionmenu?location=" + @preValueIterator.Current.Value + "\">")


   @fillDropDown(1084,"East Midlands")



Popular posts from this blog

Umbraco Razor Sort Nodes Ascending or Descending

Umbraco Razor get Querystring

Create a .NET Contact Form that Gets the Last Url Visited in C# Can also be Used in Umbraco