1-888-365-2779
+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / generic content - resolving embedded sitefinity links

generic content - resolving embedded sitefinity links

5 posts, 0 answered
  1. clayman
    clayman avatar
    38 posts
    Registered:
    23 Sep 2009
    06 Nov 2009
    Link to this post
    I am accessing generic content through the ContentManager API.  In my code, I search for and return a particular IContent item, then set the appropriate property (e.g. Literal.Text) on my user control to display that IContent.

    This works fine, however if I use the generic content editor to incorporate links to other sitefinity pages, or images to library items, that portion of the content is not being resolved. 

    For example, here is the resulting image tag as rendered in my page:
    <img alt="" src="[Libraries]dce4d72c-011e-456c-8f10-e7d29b91454a"

    Here's a resulting link:
    <href="[Sitefinity]a17ce061-1e31-4e84-bf2d-bd5feb8c8ded" title="View Fund Summary">here</a> 

    Within the admin pages, the content renders properly.  Is there something I need to do with the IContent before passing it's .ToString() contents to the user control?  Where in the pipeline does Sitefinity resolve these tags?

    Thanks!
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    16 Jun 2017
    08 Nov 2009
    Link to this post
    Hello clayman,

    You need to resolve the links. More information at resolving dynamic links. Since you are using IContent objects you can use LinkParser.ResolveLinks(parameter, ContentManager.ResolveItemUrl);

    Let me know if you need further assistance.

    Regards,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  3. Benjamin Nwaneampeh
    Benjamin Nwaneampeh avatar
    4 posts
    Registered:
    22 Feb 2010
    25 Feb 2010
    Link to this post
    Can you please give an example of this. I'm trying to resolve links within a content item.
  4. Benjamin Nwaneampeh
    Benjamin Nwaneampeh avatar
    4 posts
    Registered:
    22 Feb 2010
    25 Feb 2010
    Link to this post
    OK, I've now got it. It should just be as below:

    var htmlContent = LinkParser.ResolveLinks(htmlContent, ContentManager.ResolveItemUrl)

    This will return your htmlContent with all the links parsed.
  5. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    16 Jun 2017
    25 Feb 2010
    Link to this post
    Hello Benjamin Nwaneampeh,

    This calls GetItemUrl method that is shown in the post, so basically it is the same.

    Kind regards,
    Ivan Dimitrov
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Register for webinar
5 posts, 0 answered