More in this section

Forums / General Discussions / Custom Menu Control and Web Editors

Custom Menu Control and Web Editors

4 posts, 0 answered
  1. S. Webb
    S. Webb avatar
    36 posts
    Registered:
    28 Dec 2006
    29 Nov 2010
    Link to this post
    Hi,

    I've been trying to create a custom menu control that will allow me to use a WebEditor like 3.7 for the "StartingNodeUrl" property, any suggestions?

    using System;
    using System.Web;
    using System.ComponentModel;
      
    using Telerik;
    using Telerik.Sitefinity;
    using Telerik.Sitefinity.Web;
    using Telerik.Web.UI;
    using Telerik.Sitefinity.Web.UI;
      
      
    [DefaultProperty("StartingNodeUrl")]
    public partial class UserControls_Nav_SiteMenu : System.Web.UI.UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            this.RadMenu1.MaxDataBindDepth = _LastExpandLevel;
            this.RadMenu1.ClickToOpen = _ClickToOpen;
            this.SiteMapDataSource1.StartingNodeUrl = _StartingNodeUrl;
            this.SiteMapDataSource1.StartFromCurrentNode = _StartFromCurrentNode;
            this.SiteMapDataSource1.ShowStartingNode = _ShowStartingNode;
        }
      
        #region Data Fields
      
        private int _LastExpandLevel = -1;
        private bool _ClickToOpen = false;
        private bool _HideUrlForGroupPages = false;
        private string _StartingNodeUrl = "";
        private bool _StartFromCurrentNode = false;
        private bool _ShowStartingNode = false;
      
        #endregion
      
        #region Properties
      
        [Browsable(true)]
        [Category("Behavior")]
        public int LastExpandLevel
        {
            get
            {
                if (_LastExpandLevel < 0)
                    return 0;
                return _LastExpandLevel;
            }
            set
            {
                if (value == 0)
                    _LastExpandLevel = -1;
                else
                    _LastExpandLevel = value;
            }
        }
          
      
        [Browsable(true)]
        [Category("Behavior")]
        public bool ClickToOpen
        {
            get
            {
                return _ClickToOpen;
            }
            set
            {
                _ClickToOpen = value;
            }
        }
      
      
        [Browsable(true)]
        [Category("Behavior")]
        [DefaultValue(false)]
        public bool HideUrlForGroupPages
        {
            get
            {
                return _HideUrlForGroupPages;
            }
            set
            {
                _HideUrlForGroupPages = value;
            }
        }
          
      
        [WebEditor("Telerik.Sitefinity.Web.UI.PagesSelector, Telerik.Sitefinity")]
        [Browsable(true)]
        [Category("Navigation")]
        public string StartingNodeUrl
        {
            get
            {
                return _StartingNodeUrl;
            }
            set
            {
                _StartingNodeUrl = value;
            }
        }
      
      
        [Browsable(true)]
        [Category("Navigation")]
        public bool StartFromCurrentNode
        {
            get
            {
                return _StartFromCurrentNode;
            }
            set
            {
                _StartFromCurrentNode = value;
            }
        }
      
      
        [Browsable(true)]
        [Category("Navigation")]
        public bool ShowStartingNode
        {
            get
            {
                return _ShowStartingNode;
            }
            set
            {
                _ShowStartingNode = value;
            }
        }
      
        #endregion
    }

    Thanks,
    Steve
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    01 Dec 2010
    Link to this post
    Hello S. Webb,

    We have not implemented WebEditors that you can use directly as a part of a public property in "Advanced" section of a control. You have to create a control designer and call the webeditor from it. You can take a look at How to create a widget tutorial and this sample

    Sincerely yours,
    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
  3. Timothy
    Timothy avatar
    3 posts
    Registered:
    18 Nov 2010
    06 Dec 2010
    Link to this post
    Hi Ivan,
    From the SDK, online documentation and forum samples I've seen, it looks like the widget has to be a custom control, versus being a user control, in order to create custom control designers for it. Is this correct? If not, are there any samples of creating a custom control designer for a user control style widget?

    Thank you,
    Tim
  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    06 Dec 2010
    Link to this post
    Hi Timothy,

    You should have a custom control. You cannot have a control designer with a user control.

    Greetings,
    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
4 posts, 0 answered