Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Abdul Raheem 17 posts 61 karma points
    Sep 25, 2014 @ 16:26
    Abdul Raheem
    0

    How to get the values of customize datatype multiple drop down list using Razor

    Hi I am new to umraco and very new to Razor.

    I have created a multiple drop down list. From admin panel user can select values of that drop down list in the content section. But now I need to get the values in that drop down list to be displayed on the web page. For this I am trying to create a macro using scripting files. I think I am doing fine till there.

    Can any one tell me how i can get the values of custom datatype. 

    My document type name is Category, data-type name is also Category.

     

    Thanks 

  • Abdul Raheem 17 posts 61 karma points
    Sep 25, 2014 @ 18:12
    Abdul Raheem
    0

    Hi have some one need help I did it. I am pasting the sample code 

     @using umbraco.MacroEngines

    @inherits DynamicNodeContext

    @using System.Xml.XPath

    @{

    var baseNode = Model.AncestorOrSelf();

            XPathNodeIterator iterator = umbraco.library.GetPreValues(8547);

            iterator.MoveNext(); //move to first

            XPathNodeIterator preValues = iterator.Current.SelectChildren("preValue", "");

    foreach(var item in preValues)

           {

               preValues.MoveNext();

           string preValue = preValues.Current.Value;

                   <ul >

    <li>

    @preValue

    </li>  

             </ul> 

     }

  • Dennis Aaen 4500 posts 18255 karma points admin hq c-trib
    Sep 25, 2014 @ 18:42
    Dennis Aaen
    0

    Hi Abdul,

    Have you have seen this documentation about the bulid-in property editors in Umbraco and how to get data out them using the DynamicNode razor syntax

    And especially the documentation for the Dropdown-Multiple-Publish-Keys Editor and the Dropdown list multiple editor.

    Hope this can help you a step further,

    /Dennis

Please Sign in or register to post replies

Write your reply to:

Draft