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

Forums / Bugs & Issues / Problem with Selected Link , when using page selector

Problem with Selected Link , when using page selector

5 posts, 0 answered
  1. Nadya
    Nadya avatar
    52 posts
    Registered:
    17 Dec 2008
    13 Mar 2009
    Link to this post
    Hi,

    I am using a page selector in a Sitefinity 3.6 project  and I am experiencing the following problem.

    When I select a page, 
    the link to the page is not showing properly in the textbox. 
    For example if I have start.aspx and I select it I  expect url : "~/start.aspx" but I am getting :
    [Sitefinity]Some GUID.

    How can I fix this ?

    Thank you very much,

    Nadya

  2. Georgi
    Georgi avatar
    3583 posts
    Registered:
    28 Oct 2016
    16 Mar 2009
    Link to this post
    Hi Nadezhda ,

    This is expected behavior. The link would be resolved once you save the content.

    We introduced that feature in Sitefinity 3.6. It allows you to have dynamic links. Imagine you change the page location, then the link will in the Editor will be updated automatically, since we are resolving the page by its Guid and not by its path.

    I hope this helps.

    Best wishes,
    Georgi
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  3. Nadya
    Nadya avatar
    52 posts
    Registered:
    17 Dec 2008
    16 Mar 2009
    Link to this post
    Thank you.
  4. Nadya
    Nadya avatar
    52 posts
    Registered:
    17 Dec 2008
    16 Mar 2009
    Link to this post
    Hi ,

    The thing about my project is that I am using my page selector as there isn't a built-in one. So I need a public method to be able to resolve this URL by myself.
    Something like this :

    string url = Telerik.Cms.Something.ResolveUrl(“[Sitefinity]{GUID}”);

    Can you , please tell me where I can find this method ?

    Thank you again.

  5. Georgi
    Georgi avatar
    3583 posts
    Registered:
    28 Oct 2016
    17 Mar 2009
    Link to this post
    Hi Nadezhda ,

    Please use this approach:
    //take the item definition 
    string def = "[Sitefinity]{GUID}"
    if (!String.IsNullOrEmpty(def)) 
        //extract the provider, and the guid 
        string[] keys = def.Split(']'); 
        string providerName = keys[0].Replace("[", String.Empty); 
        Guid itemId = new Guid(keys[1]); 
     
        CmsManager manager = new CmsManager(); 
        ICmsPage page = manager.GetPage(itemId) as ICmsPage; 
        string url = page.StaticUrl; // url generated by Sitefinity 
     

    If you want to the same for dynamic images instead of dynamic pages, you could use:
    //take the item definition 
    string def = this.ImageUrl; 
    if (!String.IsNullOrEmpty(def)) 
        //extract the provider, and the guid 
        string[] keys = def.Split(']'); 
        string providerName = keys[0].Replace("[", String.Empty); 
        Guid itemId = new Guid(keys[1]); 
     
        //initialize the manager with the item's provider 
        LibraryManager manager = new LibraryManager(providerName); 
        //get the actual item using the manager 
        IContent item = manager.GetContent(itemId); 
        //get the item Url with its extension 
        this.ImageUrl = item.UrlWithExtension; 

    Let me know if you need any further help.

    All the best,
    Georgi
    the Telerik team


    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
Register for webinar
5 posts, 0 answered