Custom Modules
Are Custom Type Editors supported in the CTP of SF4? I would like to build some custom modules but I'm running into a roadblock because the editors need to be more complex than textboxes. I would like to create a custom module with an image, hyperlink (select target from a drop down list), and WYSIWYG editor. Any ideas if this is possible this early? I'm looking forward to the Beta release...is it going to be early or late July?
Hi Shawn,
There will be support for custom WebUIType editor, but the implementation is a bit different than this one in 3.x edition.
Again you have a template with a controls
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %><%@ Register Assembly="Telerik.Sitefinity" Namespace="Telerik.Sitefinity.Web.UI" TagPrefix="sitefinity" %> <sitefinity:ResourceLinks id="resourcesLinks" runat="server"> <sitefinity:ResourceFile JavaScriptLibrary="JQuery" /> <sitefinity:ResourceFile Name="Skins/Grid.css" /> <sitefinity:ResourceFile Name="Skins/ToolBar.css" /> <sitefinity:ResourceFile Name="Skins/Ajax.css" /></sitefinity:ResourceLinks><asp:SiteMapDataSource ID="SiteMapDataSource1" runat="server" /><telerik:RadTreeView id="RadTreeView1" runat="server" DataSourceID="SiteMapDataSource1" Skin="Sitefinity" OnClientNodeClicked="function() return false;" > <DataBindings> <telerik:RadTreeNodeBinding ValueField="Id" /> </DataBindings> </telerik:RadTreeView></div><p class="sfButtonArea sfSelectorBtns"> <asp:LinkButton ID="DoneButton" runat="server" OnClientClick="return false;" CssClass="sfLinkBtn sfSave">DoneButton</asp:LinkButton> <asp:Literal ID="literalOr" runat="server" Text="<%$Resources:Labels, or %>" /> <asp:LinkButton ID="CancelButton" runat="server" CssClass="sfCancel" OnClientClick="return false;">CancelButton</asp:LinkButton></p>public class CustomDialogSelector: SimpleScriptView #region Public Methods public bool CheckBoxes get; set; #endregion #region Properties protected override string LayoutTemplateName get return templatePath; private RadTreeView SiteMapTreeView get return Container.GetControl<RadTreeView>(); private LinkButton DoneButton get return Container.GetControl<LinkButton>("DoneButton", true); private string UseCheckboxes get return this.CheckBoxes.ToString().ToLower(); private LinkButton CancelButton get return Container.GetControl<LinkButton>("CancelButton", true); public string OnDoneClientSelection get; set; #endregion #region Methods /// <summary> /// Gets a collection of script descriptors that represent (JavaScript) client components. /// </summary> public override IEnumerable<System.Web.UI.ScriptDescriptor> GetScriptDescriptors() var descriptor = new ScriptControlDescriptor(this.GetType().FullName, this.ClientID); descriptor .AddComponentProperty("siteMapTree", SiteMapTreeView.ClientID); scriptDescriptor.AddElementProperty("doneButton",DoneButton.ClientID); scriptDescriptor.AddElementProperty("cancelButton", CancelButton.ClientID); scriptDescriptor.AddProperty("checkboxes", UseCheckboxes); if (!string.IsNullOrEmpty(this.OnDoneClientSelection)) scriptDescriptor.AddEvent("doneClientSelection", this.OnDoneClientSelection); return new[] scriptDescriptor ; /// <summary> /// Gets a collection of objects that define script resources that the control requires. /// </summary> public override IEnumerable<System.Web.UI.ScriptReference> GetScriptReferences() // here you can return reference to a custom script that your control // will use. string assembly = this.GetType().Assembly.GetName().ToString(); List<ScriptReference> res = new List<ScriptReference> new ScriptReference(selectorScript, assembly), ; return res; protected override void OnPreRender(EventArgs e) base.OnPreRender(e); var controlSiteMap = this.SiteMapTreeView; controlSiteMap .CheckBoxes = this.CheckBoxes; controlSiteMap .DataBind(); controlSiteMap .ExpandAllNodes(); protected override void InitializeControls(Telerik.Sitefinity.Web.UI.GenericContainer container) #endregion #region Fields private const string selectorScript = "Telerik.Sitefinity.Samples.AlterScript.js"; private const string templatePath= "Telerik.Sitefinity.Resources.Templates.Samples.PageTemplate.ascx"; #endregion Ivan,
Hello Andrei,
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 as the previous posts suggests.
I believe that we will be able to finish and document web property editors for the official release.
Kind regards,
Ivan Dimitrov
the Telerik team
Ivan,
Are the WebEditors in the official release?
I tried the following, which I didn't think was correct anyway, but it didn't do anything.
[Telerik.Sitefinity.Web.UI.WebEditor("Telerik.Sitefinity.Web.UI.EditorExternalDialogModes.Document, Telerik.Sitefinity")]
Also, sorry to hijack, but is System.ComponentModel.DisplayNameAttribute supported for properties? SF seems to ignore the display name. Not a big deal if it's not.
Eric,
No they are not, and no Road-Map yet as to when they may be released. For now, its all about Custom Controls i'm afraid. There are quite a few threads on doing it through Custom Controls.
Have fun,
Andrei