Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
I'm trying to output the Url from the uComponents URL picker inside of a ASP.NET repeater.
<a class="cnt-more" href="<%# ((Node)Container.DataItem).GetProperty("quoteLink").Value.ToString() %>"> <p class="xt"><%#((Node)Container.DataItem).GetProperty("quoteLinkText").Value.ToString()%></p> <p class="vp">Get a quote</p> </a>
I can get the complete output from the picker but not the Url.
I'm using the following method to resolve UrlPicker values to a POCO:
/// <summary> /// Resolves the value of a UrlPicker datatype to a .NET object /// </summary> /// <param name="urlPickerXml">The value of the UrlPicker in XML format</param> /// <returns>A UrlPicker .NET object</returns> public static UrlPicker ResolveUrlPicker(string urlPickerXml) { XmlDocument xmlDoc = new XmlDocument(); xmlDoc.LoadXml(urlPickerXml); UrlPicker urlPicker = new UrlPicker() { Mode = (UrlPicker.UrlPickerMode)Enum.Parse(typeof(UrlPicker.UrlPickerMode), xmlDoc.SelectSingleNode("//url-picker").Attributes["mode"].InnerText), Url = xmlDoc.SelectSingleNode("//url").InnerText, NewWindow = bool.Parse(xmlDoc.SelectSingleNode("//new-window").InnerText), }; XmlNode linkTitleElement = xmlDoc.SelectSingleNode("//link-title"); if(linkTitleElement != null) urlPicker.LinkTitle = linkTitleElement.InnerText; if (!string.IsNullOrEmpty(xmlDoc.SelectSingleNode("//node-id").InnerText)) { urlPicker.NodeId = int.Parse(xmlDoc.SelectSingleNode("//node-id").InnerText); urlPicker.Url = umbraco.library.NiceUrl(urlPicker.NodeId.Value); } return urlPicker; }
And this is the POCO class:
/// <summary> /// POCO for UrlPicker /// </summary> public class UrlPicker { /// <summary> /// The mode (url/content/media/upload) /// </summary> public UrlPickerMode Mode { get; set; } /// <summary> /// The url /// </summary> public string Url { get; set; } /// <summary> /// Open in new window? /// </summary> public bool NewWindow { get; set; } /// <summary> /// The link title /// </summary> public string LinkTitle { get; set; } /// <summary> /// The node id /// </summary> public int? NodeId { get; set; } /// <summary> /// Enum for UrlPicker modes /// </summary> public enum UrlPickerMode { URL, Content, Media, Upload } }
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
Get URL picker values inside a repeater
I'm trying to output the Url from the uComponents URL picker inside of a ASP.NET repeater.
I can get the complete output from the picker but not the Url.
I'm using the following method to resolve UrlPicker values to a POCO:
And this is the POCO class:
is working on a reply...