Copied to clipboard

Flag this post as spam?

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


  • John Hodgkinson 613 posts 355 karma points
    Feb 10, 2017 @ 13:05
    John Hodgkinson
    0

    Access DataType values from partial view

    I'm sure this is a simple question but was not able to find anything on initial searching. How can I access the data values from a partial view?

    When Umbraco native data types I could do something like:

    // Get data type id
    var dataTypeId = 1234;
    
    var preValues = PreValues.GetPreValues(dataTypeId).Values;
    var enumerator = preValues.GetEnumerator();
    
    <div class="datatype-items">    
        <ul>
        @while (enumerator.MoveNext())
        {           
            // Get List Item Value  
            var category = ((umbraco.cms.businesslogic.datatype.PreValue)enumerator.Current).Value;
    
            // Output item name 
            <li>@category</li>
        }
        </ul>
    </div>
    

    Many thanks in advance!

  • Alex Skrypnyk 6150 posts 24109 karma points MVP 8x admin c-trib
    Feb 11, 2017 @ 23:45
    Alex Skrypnyk
    0

    Hi John

    Do you want to get data of some Umbraco node?

    Datatypes don't store values of data, this is only type of possible data in Umbraco node

    How to get data from nodes read here - https://our.umbraco.org/documentation/reference/templating/mvc/querying

    Thanks

    Alex

  • Hendy Racher 863 posts 3849 karma points MVP 2x admin c-trib
    Feb 21, 2017 @ 21:27
    Hendy Racher
    0

    Hi John,

    There's a strongly typed Picker object that returns the picked items, but unfortunately it doesn't have a property to return the source collection (issue on github)

Please Sign in or register to post replies

Write your reply to:

Draft