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

Forums / Developing with Sitefinity / DhlIdEditor Sample

DhlIdEditor Sample

3 posts, 0 answered
  1. chrishawn
    chrishawn avatar
    5 posts
    Registered:
    23 Jan 2009
    25 Mar 2009
    Link to this post
    Is there a sample somewhere of how to use:
    [WebEditor("Telerik.Cms.Web.UI.DhlIdEditor, Telerik.Cms")]

    only reference i could find said they would have shown a sample but it was too complicated.

    I just need to get a reference to a selected page GUID so I can instantiate it.
    And when I use the UrlEditorWrapper it only returns a string path and if I try to get
    the ID with the UrlHelper.GetUrl my system just hangs up and pegs IIS out to 60% cpu and never comes back
  2. chrishawn
    chrishawn avatar
    5 posts
    Registered:
    23 Jan 2009
    25 Mar 2009
    Link to this post
    Okay after a little more digging it appears to describe it in the middle of this thread

    sample code here for future reference, seems you have to have 2 properties

    [TypeConverter("Telerik.Cms.Web.UI.GuidTypeConverter, Telerik.Cms"), WebEditor("Telerik.Cms.Web.UI.DhlIdEditor, Telerik.Cms"), Category("Navigation"), DefaultValue(typeof(Guid), "00000000-0000-0000-0000-000000000000")] 
        public Guid PageId { 
            get { 
                return this.pageId; 
            } 
            set { 
                this.pageId = value; 
            } 
        } 
     
        [UrlProperty, WebEditor("Telerik.Cms.Web.UI.DhlUrlEditor, Telerik.Cms"), Bindable(true), Category("Navigation"), DefaultValue("")] 
        public string NavigateUrl { 
            get { 
                if (this.PageId != Guid.Empty) { 
                    CmsManager manager = new CmsManager(); 
                    ICmsPage page = (ICmsPage)manager.GetPage(this.PageId); 
                    if (page != null) { 
                        if (page.PageType == CmsPageType.External) 
                            return page.ExternalUrl; 
                        else { 
                            return UrlHelper.ResolveLanguageUrl(page.DefaultUrl.Url); 
                        } 
                    } 
                } 
                return this.navigateUrl; 
            } 
            set { 
                this.navigateUrl = value; 
            } 
        } 
     
        private Guid pageId; 
        private string navigateUrl;  

  3. Georgi
    Georgi avatar
    3583 posts
    Registered:
    28 Oct 2016
    25 Mar 2009
    Link to this post
    Hello chrishawn,

    I am glad you have found this thread. Let us know if you need any further information.

    Best wishes,
    Georgi
    the Telerik team

    Check out Telerik Trainer , the state of the art learning tool for Telerik products.
Register for webinar
3 posts, 0 answered