Problem in updating a field with customdesigner
Hello Telerik,
I'm tring to develop a custom designer for a simple user control I've done.
The problem I got is that the setter of my Custom user control (not designer) is not updated (and I got a js exception when loading)
Here're my classes (taking as example this link) :
Custom UserControl (the part it's intresting) :
private int _ProvaID = 5; public int ProvaID get return _ProvaID; set _ProvaID = value; Type.registerNamespace("SitefinityWebApp.Resources"); SitefinityWebApp.Resources.FormattedDownloadList_Designer = function (element) SitefinityWebApp.Resources.FormattedDownloadList_Designer.initializeBase(this, [element]); SitefinityWebApp.Resources.FormattedDownloadList_Designer.prototype = initialize: function () SitefinityWebApp.Resources.FormattedDownloadList_Designer.callBaseMethod(this, 'initialize'); , dispose: function () SitefinityWebApp.Resources.FormattedDownloadList_Designer.callBaseMethod(this, 'dispose'); , refreshUI: function () var data = this._propertyEditor().get_control(); jQuery("#ProvaID").val(data.ProvaID); , applyChanges: function () var controlData = this._propertyEditor().get_control(); controlData.ProvaID = jQuery("#ProvaID").val(); <%@ Control Language="C#" AutoEventWireup="true" CodeBehind="FormattedDownloadList_Designer.ascx.cs" Inherits="SitefinityWebApp.Resources.FormattedDownloadList_Designer" %> <%@ Register Assembly="Telerik.Sitefinity" Namespace="Telerik.Sitefinity.Web.UI" TagPrefix="sitefinity" %> <%--<sitefinity:ResourceLinks ID="resourcesLinks" runat="server"> <sitefinity:ResourceFile AssemblyInfo="SitefinityWebApp.Controls.FormattedDownloadList, SitefinityWebApp, Version=4.0.1210.0, Culture=neutral, PublicKeyToken=null" Static="true" /> </sitefinity:ResourceLinks>--%> <div id="LibraryOption"> <label for="ProvaID"> Width</label> <asp:TextBox runat="server" ID="ProvaID" Text=""></asp:TextBox> </div> public partial class FormattedDownloadList_Designer : ControlDesignerBase protected override void InitializeControls(Telerik.Sitefinity.Web.UI.GenericContainer container) base.DesignerMode = ControlDesignerModes.Simple; protected override string LayoutTemplateName get return "SitefinityWebApp.Resources.FormattedDownloadList_Designer.ascx"; public override IEnumerable<System.Web.UI.ScriptReference> GetScriptReferences() var res = new List<ScriptReference>(base.GetScriptReferences()); var assemblyName = this.GetType().Assembly.GetName().ToString(); res.Add(new ScriptReference("SitefinityWebApp.Resources.FormattedDownloadList_Designer.js", assemblyName)); return res.ToArray(); public override IEnumerable<ScriptDescriptor> GetScriptDescriptors() //This is taken from the forum....I've got ProvaID null here ScriptControlDescriptor desc = new ScriptControlDescriptor(this.GetType().FullName, this.ClientID); // desc.AddElementProperty("ProvaID", this.ProvaID.ClientID); return new[] desc ; Hello,
I missed this piece of code :
SitefinityWebApp.Resources.FormattedDownloadList_Designer.registerClass('SitefinityWebApp.Resources.FormattedDownloadList_Designer', Telerik.Sitefinity.Web.UI.ControlDesign.ControlDesignerBase); if (typeof (Sys) !== 'undefined') Sys.Application.notifyScriptLoaded();