Copied to clipboard

Flag this post as spam?

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


  • Franz 13 posts 66 karma points
    Nov 27, 2013 @ 18:48
    Franz
    0

    SqlAutoComplete: display value in partial view (razor)

    Hello everyone from a complete n00b! :)

    I'm trying to display the value of a datatype SqlAutoComplete in a partial view using razor.

    The datatype is set up like this (see image).

    Basically, the editors of our website will be able/forced to choose 1 and only 1 item returned from one of our DB (external to Umbraco) as a property of a node.

    All works as expected in the content editing inteface.

    I'm struggling, however, to display the selected value in a partial view using razor (bear in min I'm a utter n00b!).

    For the sake of seeing if I'm able to grab the property value, my code looks like this, so far, in my partial view:

    --------------------------

    @inherits Umbraco.Web.Mvc.UmbracoTemplatePage
    @{
    var servicePropertyValue = CurrentPage.GetPropertyValue("selectService");
    var serviceProperty = CurrentPage.selectService;
    }
    
    <p>@servicePropertyValue</p>
    <p>@serviceProperty</p>

    --------------------------

    Which returns this:

    --------------------------

    <p><SqlAutoComplete><Item Text="some text" Value="https://some.url.here" /></SqlAutoComplete></p>
    <p>System.Collections.Generic.List`1[uComponents.DataTypes.Shared.Models.AutoCompleteItem]</p>

    --------------------------

    Now, everything seems ok (I can get the property value), but how do I get only the Value of the Item (that's to say the Value="https://some.url.here" , to use as an href?

    Any razor help is much appreciated. :)

  • Franz 13 posts 66 karma points
    Nov 28, 2013 @ 12:02
    Franz
    0

    Have to add. Our environment is Umbraco 6.1.6 and using uComponents 6.0.0, so I should be able to use PropertyEditorValueConverter, but I'm struggling on how to implement it. ^^

  • 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