1-888-365-2779
+1-888-365-2779
Try Now
More in this section

Forums / Bugs & Issues / Issue using Telerik.Sitefinity.Web.UI.Fields Controls in Back End Pages

Issue using Telerik.Sitefinity.Web.UI.Fields Controls in Back End Pages

4 posts, 0 answered
  1. anthony
    anthony avatar
    3 posts
    Registered:
    18 Oct 2010
    07 Dec 2011
    Link to this post
    Hi,

    All of my sitefinity based web controls are returning the error below and then not appearing on the page. Any idea what the cause may be or how to fix it?

    Resolution of the dependency failed, type = "Telerik.Sitefinity.Configuration.ConfigManager", name = "XmlConfigProvider".
    Exception occurred while: Calling constructor Telerik.Sitefinity.Configuration.ConfigManager(System.String providerName).
    Exception is: ArgumentNullException - Value cannot be null.
    Parameter name: path1
    -----------------------------------------------
    At the time of the exception, the container was:

      Resolving Telerik.Sitefinity.Configuration.ConfigManager,XmlConfigProvider
      Calling constructor Telerik.Sitefinity.Configuration.ConfigManager(System.String providerName)
  2. Stanislav Velikov
    Stanislav Velikov avatar
    1113 posts
    Registered:
    18 Sep 2017
    12 Dec 2011
    Link to this post
    Hi Anthony,

    The error is indicating configuration files and this leads me to the conclusion the problem is with how the widget is registered.
    I will give you a sample of the procedure of adding a control. It is also described here.
    1.Create the control in the visual studio project either website or webapplication.
    2. Build the project if it is a webapplication (no build is required when it is website)
    3. Register the control in Admininistration->Settings->Advanced->toolboxesconfig->Toolboxes->page controls->sections->"choose a section"
    Contriol type:
    ~/MyControl.ascx (if the control is in a folder incluse the folder name too)
    Name:
    MyControl

    Title:
    MyControl

    If you are still getting the problem can you attach the control code so I can test adding at my and if I encouter the problem will provide you with a workaroud? 

    All the best,
    Stanislav Velikov
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. anthony
    anthony avatar
    3 posts
    Registered:
    18 Oct 2010
    12 Dec 2011
    Link to this post
    I registered the module following the instructions in this tutorial.
    http://www.sitefinity.com/blogs/joshmorales/posts/11-06-30/sitefinity_intra-site_module_webinar_notes.aspx

    Is there a way for me to attach the module itself for you to look at?
    The attach file option here only allows image types.

    Here is the module registration code for one of the admin modules. When attempting to add pre-existing sitefinity controls,
    ie the link/linkdialog control i get odd behavior.
    It may be that i am just implementing them incorrectly. Are there any demonstrations on how to implement these controls?

    Specifically i would like to tie into,
    Links (internal/external)
    Documents (upload/referenc pre-uploaded images)

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using Telerik.Sitefinity.Configuration;
    using Telerik.Sitefinity.Abstractions;
    using Telerik.Sitefinity.Services;
    //using SitefinityWebApp.Modules.Common.Data;
    using Telerik.Sitefinity.GenericContent.Model;
    using Telerik.Sitefinity.Pages.Model;
    using Telerik.Sitefinity.Modules.Pages.Configuration;
    using Telerik.Sitefinity.Modules.Pages;
    using SitefinityWebApp.Modules.OurLocation.Admin;
    using SitefinityWebApp.Modules.OurLocation.Data;
     
    namespace SitefinityWebApp.Modules.OurLocation
    {
        public class OurLocationModule : ModuleBase
        {
            /// <summary>
            /// Installs this module in Sitefinity system for the first time.
            /// </summary>
            /// <param name="initializer">The Site Initializer. A helper class for installing Sitefinity modules.</param>
            public override void Install(SiteInitializer initializer)
            {
     
                //OurLocationModule.EnsureData();
     
                #region Install Pages
                 
                // get page manager
                var pageManager = initializer.PageManager;
     
                // create Module Landing Page if doesn't exist
                var landingPage = pageManager.GetPageNodes().SingleOrDefault(p => p.Id == this.LandingPageId);
                if (landingPage == null)
                {
                    // create admin list view control and add to new landing page
                    var ctrl = pageManager.CreateControl<PageControl>("~/Modules/OurLocations/Admin/OurLocationAdminView.ascx", "Content");
                    CreatePage(pageManager, LandingPageId, SiteInitializer.ModulesNodeId, OurLocationModule.ModuleName, true, OurLocationModule.ModuleName, ctrl, false);
                }
     
                // create OurLocation "Create" Page if doesn't exist
                var createPage = pageManager.GetPageNodes().SingleOrDefault(p => p.Id == this.CreatePageId);
                if (createPage == null)
                {
                    // create admin control, set properties
                    var ctrl = pageManager.CreateControl<PageControl>("~/Modules/OurLocations/Admin/OurLocationAddEditView.ascx", "Content");
                    var prop = ctrl.Properties.FirstOrDefault(p => p.Name == "Mode");
                    if (prop == null)
                    {
                        prop = new ControlProperty();
                        prop.Id = Guid.NewGuid();
                        prop.Name = "Mode";
                        ctrl.Properties.Add(prop);
                    }
     
                    // set control to "Create" mode
                    prop.Value = SitefinityWebApp.Modules.OurLocation.Admin.OurLocationAddEditView.AdminControlMode.Create.ToString();
     
                    // create backend page and add control
                    CreatePage(pageManager, CreatePageId, LandingPageId, "Create", false, "Create Location", ctrl, true);
                }
     
                // create OurLocation "Edit" Page if doesn't exist
                var editPage = pageManager.GetPageNodes().SingleOrDefault(p => p.Id == this.EditPageId);
                if (editPage == null)
                {
                    // create admin control, set properties
                    var ctrl = pageManager.CreateControl<PageControl>("~/Modules/OurLocations/Admin/OurLocationAddEditView.ascx", "Content");
                    var prop = ctrl.Properties.FirstOrDefault(p => p.Name == "Mode");
                    if (prop == null)
                    {
                        prop = new ControlProperty();
                        prop.Id = Guid.NewGuid();
                        prop.Name = "Mode";
                        ctrl.Properties.Add(prop);
                    }
     
                    // set control to "Create" mode
                    prop.Value = SitefinityWebApp.Modules.OurLocation.Admin.OurLocationAddEditView.AdminControlMode.Edit.ToString();
     
                    // create backend page and add control
                    CreatePage(pageManager, EditPageId, LandingPageId, "Edit", false, "Edit Location", ctrl, true);
                }
     
                #endregion
     
                #region Register Toolbox Widget
     
                // Install configuration
                // get section from toolbox
                var config = initializer.Context.GetConfig<ToolboxesConfig>();
                var pageControls = config.Toolboxes["PageControls"];
                var section = pageControls
                    .Sections
                    .Where<ToolboxSection>(e => e.Name == ToolboxesConfig.ContentToolboxSectionName)
                    .FirstOrDefault();
     
                // create section it if it doesn't exist
                if (section == null)
                {
                    section = new ToolboxSection(pageControls.Sections)
                    {
                        Name = ToolboxesConfig.ContentToolboxSectionName,
                        Title = "ContentToolboxSectionTitle",
                        Description = "ContentToolboxSectionDescription",
                        ResourceClassId = typeof(PageResources).Name
                    };
                    pageControls.Sections.Add(section);
                }
     
                //// add widget to section if it doesn't exist
                //if (!section.Tools.Any<ToolboxItem>(e => e.Name == OurLocationView.ViewName))
                //{
                //    var tool = new ToolboxItem(section.Tools)
                //    {
                //        Name = OurLocationView.ViewName,
                //        Title = "OurLocation View",
                //        Description = "Public control for the OurLocation module",
                //        ControlType = "~/Modules/OurLocation/OurLocationView.ascx",
                //        CssClass = "sfOurLocationWidget"
                //    };
                //    section.Tools.Add(tool);
                //}
                #endregion
            }
     
            private void CreatePage(PageManager pageManager, Guid pageID, Guid parentPageID, string UrlName, bool ShowInNavigation, string Title, PageControl control, bool enableViewstate)
            {
                // get backend node
                var parentPage = pageManager.GetPageNode(parentPageID);
     
                // Create a node in the SiteMap for that page.
                var node = pageManager.CreatePageNode(pageID);
                pageManager.ChangeParent(node, parentPage);
                parentPage.Nodes.Add(node);
     
                // set page properties
                node.RenderAsLink = true;
                node.Title = Title;
                node.ShowInNavigation = ShowInNavigation;
                node.UrlName = UrlName;
     
                // Create a PageData object to hold the actual page contents
                var pageData = pageManager.CreatePageData();
                pageData.Template = pageManager.GetTemplate(SiteInitializer.DefaultBackendTemplateId);
                pageData.HtmlTitle = Title;
                pageData.Title = Title;
                pageData.Status = ContentLifecycleStatus.Live;
                pageData.Visible = true;
                pageData.EnableViewState = enableViewstate;
                pageData.Version = 1;
     
                //associate the node with the PageData object
                node.Page = pageData;
     
                // add admin control to the page
                if (control != null) pageData.Controls.Add(control);
            }
     
            /// <summary>
            /// Upgrades this module from the specified version.
            /// </summary>
            /// <param name="initializer">The Site Initializer. A helper class for installing Sitefinity modules.</param>
            /// <param name="upgradeFrom">The version this module us upgrading from.</param>
            public override void Upgrade(SiteInitializer initializer, Version upgradeFrom) { }
     
            /// <summary>
            /// Gets the module config.
            /// </summary>
            /// <returns></returns>
            protected override ConfigSection GetModuleConfig() { return null; }
     
            /// <summary>
            /// Gets the landing page id for each module inherit from <see cref="T:Telerik.Sitefinity.Services.SecuredModuleBase"/> class.
            /// </summary>
            /// <value>
            /// The landing page id.
            /// </value>
            public override Guid LandingPageId
            {
                get { return new Guid("D7CC19E4-BCE6-4D0F-97D0-C2B667DBBAA8"); }
            }
     
            public Guid CreatePageId
            {
                get { return new Guid("A58078E4-9CCA-43C4-BAC7-EAE0EFE0489A"); }
            }
     
            public Guid EditPageId
            {
                get { return new Guid("C1725944-EC74-4F05-8BA2-3DA5B57CE325"); }
            }
     
            /// <summary>
            /// Gets the CLR types of all data managers provided by this module.
            /// </summary>
            /// <value>
            /// An array of <see cref="T:System.Type"/> objects.
            /// </value>
            public override Type[] Managers
            {
                get { return null; }
            }
     
            #region Static Properties
     
            public static string ModuleName = "OurLocations";
            public static string UrlName = "OurLocations";
     
            #endregion
        }
    }
  4. Stanislav Velikov
    Stanislav Velikov avatar
    1113 posts
    Registered:
    18 Sep 2017
    14 Dec 2011
    Link to this post
    Hello,

    Thank you for the additional explanations on this case.
    If you want to allow uploading and selecting of already uploaded images which is available in the built in Sitefinity modules (they are different modules inheriting from ContentModuleBase and the approach there is different) you must implement the corresponding dialog that allows selecting uploading. I have attached a project where such control is used and all the necessary files are used, to access the project use admin/password . 

    To call the dialog which selects images(documents, videos there is a property DialogMode="Image" that can be changes to Document or video).
    Notice in your template you must add RadWindow that is calling the EditorContentManagerDialog template and its javascript file to provide the functionality for this control.
    The dialog is activated in Global.asax.

    Concerning = Links (internal/external)
    I suppose you want to be able to link to pages as in the hyperlink manager of Content block widget.

    To do so you can use this control in your .ascx template.

    <sf:HtmlField
                                                ID="htfDescription"
                                                runat="server"
                                                Width="99%"
                                                Height="370px"
                                                DisplayMode="Write"
                                                IsToOverrideDialogs="true"
                                            />

    Sitefinity forums allow only images to be attached. Other files can be attached in a support ticket.  Best wishes,
    Stanislav Velikov
    the Telerik team
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested 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