Copied to clipboard

Flag this post as spam?

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


  • Høgni 16 posts 66 karma points
    Feb 13, 2014 @ 10:15
    Høgni
    0

    Displaying correct values in dropdown list

    Im currently struggeling with this problem. I have created a artical document type. In this document type i have created an custom data type named Employee picker which displays all the employees in a dropdown. The employee’s are created by an employee document type and are located in a employee folder. I want to create a dropdown on my masterpage because i want to create a search so i can return all the articals by the selected author.

    enter image description here

    Now to the problem. When i loop through my authors i only return there ID and i'm getting a lot of emtey spaces.

    @if(Model != null) { var employee = Library.NodeById(Model.author); var node = Library.NodeById(1069);

    <table>
        <tr>
            <td>Author: </td>
            <td><select class="myList">
            <option>
            @foreach(var item in node.Descendants().Where("Visible"))
            {
               <option value="@item.pageId">@item.author</option>
            }
            </option>
            </select></td>
        </tr>
    
    </table>
    

    }

  • Jeroen Breuer 4908 posts 12265 karma points MVP 5x admin c-trib
    Feb 13, 2014 @ 12:04
    Jeroen Breuer
    0

    Hello,

    What version of Umbraco are you using? Your still using a very old version of Razor and there are better ways of doing this: http://our.umbraco.org/forum/developers/razor/44664-Confused-over-when-DynamicNodeList-is-returned?p=0#comment160678

    It might be easier to do with the new code.

    Jeroen

  • Høgni 16 posts 66 karma points
    Feb 13, 2014 @ 12:09
    Høgni
    0

    My web.Config says 6.1.6

  • Jeroen Breuer 4908 posts 12265 karma points MVP 5x admin c-trib
    Feb 13, 2014 @ 12:11
    Jeroen Breuer
    100

    Ok that means you can also use IPublishedContent by creating a Partial View Macro. I recommend to do that.

    Jeroen

  • Høgni 16 posts 66 karma points
    Feb 13, 2014 @ 12:16
    Høgni
    0

    Thank you

Please Sign in or register to post replies

Write your reply to:

Draft