Quantcast
Channel: ActiveTopics
Viewing all articles
Browse latest Browse all 72689

SqlAutoComplete: display value in partial view (razor)

$
0
0

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. :)


Viewing all articles
Browse latest Browse all 72689


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>