I've got an Xpath Checkboxlist property on my templates which lists a series of speakers (//Speaker [@isDoc and string(east) = '1'] is the xPath Expression) this lists the speakers as expected when I'm creating the content but I can't seem to extract the node id's that have been selected in a c# usercontrol. I've searched everywhere for examples but all relate to XSLT and Razor and I can't get these to work. If I select CSV as the storage type the below will get me a string but its not comma separated!!!
if (myNode.HasProperty("xpather")) { string[] myCSVArray = myNode.GetProperty("xpather").Value.Split(','); foreach (string myCSVNode in myCSVArray) { litSpeakers.Text += myCSVArray.ToString(); } }
Listing xPath checkboxlist items
Hi all,
I've got an Xpath Checkboxlist property on my templates which lists a series of speakers (//Speaker [@isDoc and string(east) = '1'] is the xPath Expression) this lists the speakers as expected when I'm creating the content but I can't seem to extract the node id's that have been selected in a c# usercontrol. I've searched everywhere for examples but all relate to XSLT and Razor and I can't get these to work. If I select CSV as the storage type the below will get me a string but its not comma separated!!!
Any idea anyone??
Thanks,
Craig
Eventually got this sorted using:
foreach (Node myNode in childNodes)
{
string dataValue = myNode.GetProperty("speakers").Value.ToString();
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.LoadXml(dataValue);
foreach (XmlNode itemnode in xmlDoc.DocumentElement)
{
litNode.Text += itemnode.InnerText;
Node myUmbracoNode = new Node(Int32.Parse(itemnode.InnerText));
litNode.Text += myUmbracoNode.Name + "<br/>";
}
}
is working on a reply...