Extending Forms Control - Control Designer Empty - Front- & Back-End Development - Front- & Back-End Development - Progress Community
 Front- & Back-End Development

Extending Forms Control - Control Designer Empty

  • Extending Forms Control - Control Designer Empty
  • 352653_formEmpty.png
    Hi All,
    I have extended the forms control to send email notifications. I've followed the advice here
    http://www.sitefinity.com/devnet/forums/sitefinity-4-x/general-discussions/forms-module-notification.aspx#0 

    Now I want to extend the Control Designer Simple view to add the to address property in but have run into problems.

    I have followed examples here
    http://www.sitefinity.com/blogs/joshmorales/posts/11-09-01/anatomy_of_a_sitefinity_4_widget.aspx 
    And here
    http://www.sitefinity.com/documentation/documentationarticles/developers-guide/how-to/how-to-create-a-coverflow-control/creating-an-empty-silverlight-based-control/creating-a-custom-control 
    To create a simple view.

    I can do this without problems in a simple widget i've built but when trying the same steps with the extended forms widget I've made all I get is a box with no controls.(see attached image)

    Here is some code widget code
    inherits from FormsControl

    [ControlDesigner(typeof(emailFormDesigner))]
    public partial class emailForm : FormsControl

    My Control Designer
    public class emailFormDesigner : ControlDesignerBase
       
            
           protected override void InitializeControls(Telerik.Sitefinity.Web.UI.GenericContainer container)
           
               base.DesignerMode = ControlDesignerModes.Simple;
           
     
           public override string LayoutTemplatePath
           
               get
               
                   return _layoutTemplatePath;
               
               set
               
                   _layoutTemplatePath = value;
               
           
     
           protected override string LayoutTemplateName
           
               get return string.Empty;
           
     
           public override IEnumerable<ScriptReference> GetScriptReferences()
           
               // get script collection
               var scripts = base.GetScriptReferences() as List<ScriptReference>;
               if (scripts == null) return base.GetScriptReferences();
     
               scripts.Add(new ScriptReference(_scriptReference));
     
               return scripts.ToArray();
           
     
           private string _layoutTemplatePath = "~/Sitefinity/UserControls/emailFormTemplate.ascx";
           private string _scriptReference = "~/Sitefinity/UserControls/emailFormDesigner.js";
       

    template:
     
    public partial class emailFormTemplate : System.Web.UI.UserControl
        protected void Page_Load(object sender, EventArgs e)
        
            base.OnInit(e);
        

    template javascript

    Type.registerNamespace("SitefinityWebApp.Sitefinity.UserControls.emailForm");
     
    SitefinityWebApp.Sitefinity.UserControls.emailFormDesigner = function (element)
        SitefinityWebApp.Sitefinity.UserControls.emailFormDesigner.initializeBase(this, [element]);
     
    SitefinityWebApp.Sitefinity.UserControls.emailFormDesigner.prototype =
        initialize: function ()
            SitefinityWebApp.Sitefinity.UserControls.emailFormDesigner.callBaseMethod(this, 'initialize');
        ,
        dispose: function ()
            SitefinityWebApp.Sitefinity.UserControls.emailFormDesigner.callBaseMethod(this, 'dispose');
        ,
        refreshUI: function ()
            var controlData = this._propertyEditor.get_control();
     
            // bind widget properites to designer
            //jQuery("#txtName").val(controlData.Name);
     
     
        ,
        applyChanges: function ()
     
            var controlData = this._propertyEditor.get_control();
     
            // bind designer properties back to widget
            //controlData.Name = jQuery("#txtName").val();
     
        
     
    SitefinityWebApp.Sitefinity.UserControls.emailFormDesigner.registerClass('SitefinityWebApp.Sitefinity.UserControls.emailFormDesigner', Telerik.Sitefinity.Web.UI.ControlDesign.ControlDesignerBase);
    if (typeof (Sys) !== 'undefined') Sys.Application.notifyScriptLoaded();


    Any help would be appreciated

    Damo 
  • instead of Type.registerNamespace("SitefinityWebApp.Sitefinity.UserControls.emailForm");

    Try:
    Type.registerNamespace("SitefinityWebApp.Sitefinity.UserControls.emailFormDesigner");