More in this section

Forums / Developing with Sitefinity / Attribute for Node Selection

Attribute for Node Selection

3 posts, 0 answered
  1. Jason
    Jason avatar
    31 posts
    Registered:
    07 Nov 2007
    20 Dec 2007
    Link to this post
    Which attribute is used to define a user control class property as something who value can be selected.  That is the select button appears next to the textbox and allows for selection from the site treeview
  2. Jason
    Jason avatar
    31 posts
    Registered:
    07 Nov 2007
    20 Dec 2007
    Link to this post
    I was able to get the button up and working, however, each time I go to select a node I get a NullReferenceException, on what I am not sure.  Below is my property definition and the stack trace:

      public string _parentNodeUrl = string.Empty;
        [BindableAttribute(true)]
        [DefaultValueAttribute("")]
        [CategoryAttribute("Navigation")]
        [WebEditorAttribute("Telerik.Cms.Web.UI.DhlUrlEditor, Telerik.Cms")]
        [UrlPropertyAttribute()]
        public string ParentNodeUrl
        {
            get { return this._parentNodeUrl; }
            set { this._parentNodeUrl = value; }
        }

    NullReferenceException: Object reference not set to an instance of an object.]
    Telerik.Cms.Web.UI.PropertyEditorDialog.GetEditor() +452
    Telerik.Cms.Web.UI.PropertyEditorDialog.CreateChildControls() +155
    System.Web.UI.Control.EnsureChildControls() +87
    System.Web.UI.Control.PreRenderRecursiveInternal() +50
    System.Web.UI.Control.PreRenderRecursiveInternal() +170
    System.Web.UI.Control.PreRenderRecursiveInternal() +170
    System.Web.UI.Control.PreRenderRecursiveInternal() +170
    System.Web.UI.Control.PreRenderRecursiveInternal() +170
    System.Web.UI.Control.PreRenderRecursiveInternal() +170
    System.Web.UI.Control.PreRenderRecursiveInternal() +170
    System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint

  3. Pepi
    Pepi avatar
    981 posts
    Registered:
    31 Jan 2017
    21 Dec 2007
    Link to this post
    Hi Jason,

    Here is the correct way to achieve this:

        [WebEditor("Telerik.Cms.Web.UI.CmsUrlWebEditor, Telerik.Cms")] 
        public string ParentNodeUrl 
        { 
            get 
            { 
                return this._parentNodeUrl; 
            } 
            set 
            { 
                this._parentNodeUrl = value; 
            } 
        } 
     
        private string _parentNodeUrl; 

    Hope this helps.

    Greetings,
    Pepi
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
Register for webinar
3 posts, 0 answered