Copied to clipboard

Flag this post as spam?

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


  • Carlos 338 posts 472 karma points
    Dec 20, 2012 @ 00:18
    Carlos
    0

    How do you get Prevalues from a Datatype using Razor

    It used to be so easy to just get your prevalues from a datatype in XSLT.  1 line!!!

    What has happened and what is the easiest way to get the prealues from a dropdown list datatype using Razor?

    This is my XSLT code, how can I get it in Razor????

     

    <select name="Grades" id="teachersResourceSearchGrade">
    <option value="">Choose Grade</option>
    <xsl:for-each select="umbraco.library:GetPreValues(10610)//preValue">
    <xsl:choose>
    <xsl:when test="$resourceGradeType=@id">
    <option value="{.}" disabled="false"><xsl:value-of select="." /></option>
    </xsl:when>
    <xsl:otherwise>
    <option value="{.}" disabled="false"><xsl:value-of select="." /></option> 
    </xsl:otherwise>
    </xsl:choose> 
    </xsl:for-each>
    </select>

     

  • Sören Deger 726 posts 2833 karma points c-trib
    Dec 20, 2012 @ 07:25
    Sören Deger
    0

    Hi Carlos,

    this can help you:

    http://our.umbraco.org/forum/developers/razor/32176-get-prevalue-text-from-dropdown

     

     

    Sören

     

     

     

     

     

  • Carlos 338 posts 472 karma points
    Dec 20, 2012 @ 18:54
    Carlos
    0

    @Soren,

    That gets the prevalue for a dropdown that is a Property of the current Model.  I need it for the ID of the Datatype not the property of the Model.  In the example I put up it is getting the ID (10610)  of the custom Datatype itself not the @Model.Property.

    Thanks though.

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies