I am using the nuPickers for dropdown selection of values within my site (e.g. Candidate). I want to be able to choose all nodes with a particular value chosen within the nuPicker but I am not sure of the best way of doing this. Currently I am trying the following:
var applications = Umbraco.ContentAtXPath("//VacancyApplication[@candidate='1335']");
However this doesnt work because the candidate field is actually returning nuPickers.PropertyValueConverters.Picker
Can anyone tell me the best way of selecting all nodes within a tree where the candidate selected by a nuPicker dropdownlist equals a specific ID??
Just to check, is your nuPicker DropDown configured to save as Xml ?
Assuming this picker has a property alias of 'candidate' and is on nodes of type 'VacancyApplication' then the following XPath expression should return all VacancyApplication nodes where a candidate has a value of '1335'
I am indeed saving as XML and that work's perfectly for me, at least I now know a bit more XPath. Just out of curiosity how would the above be done within a Razor statmenet??
Sorry, I didn't see your posting of the Xml fragment when replying - hence asking about Xml.
There are a number of ways to acheive this in Razor, for example Linq with a strongly typed model makes for a nice syntax - but your XPath expression also makes for an efficient query.
Thanks, all makes sense! I don't suppose you have a link to a reference for using Linq with strongly typed model, once again this is an area I am still learning!
nuPickers and filter by field value
I am using the nuPickers for dropdown selection of values within my site (e.g. Candidate). I want to be able to choose all nodes with a particular value chosen within the nuPicker but I am not sure of the best way of doing this. Currently I am trying the following:
However this doesnt work because the candidate field is actually returning nuPickers.PropertyValueConverters.Picker
Can anyone tell me the best way of selecting all nodes within a tree where the candidate selected by a nuPicker dropdownlist equals a specific ID??
The XML produced for the node shows the following:
<candidate>
<Picker>
<Picked Key="1335"><![CDATA[Graham Carr]]></Picked>
</Picker>
</candidate>
Hi Graham,
Just to check, is your nuPicker DropDown configured to save as Xml ?
Assuming this picker has a property alias of 'candidate' and is on nodes of type 'VacancyApplication' then the following XPath expression should return all VacancyApplication nodes where a candidate has a value of '1335'
//VacancyApplication[./candidate//Picked[@Key='1335']]
HTH,
Hendy
Hi Hendy,
I am indeed saving as XML and that work's perfectly for me, at least I now know a bit more XPath. Just out of curiosity how would the above be done within a Razor statmenet??
Thanks once again.
Graham
Sorry, I didn't see your posting of the Xml fragment when replying - hence asking about Xml.
There are a number of ways to acheive this in Razor, for example Linq with a strongly typed model makes for a nice syntax - but your XPath expression also makes for an efficient query.
Thanks, all makes sense! I don't suppose you have a link to a reference for using Linq with strongly typed model, once again this is an area I am still learning!
is working on a reply...