Custom Menu Control and Web Editors
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 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
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
Hi Timothy,
You should have a custom control. You cannot have a control designer with a user control.
Greetings,
Ivan Dimitrov
the Telerik team