More in this section
Forums / Bugs & Issues / Validate widget controls generate warnings

Validate widget controls generate warnings

The forums are in read-only mode. In case that you want to directly contact the Progress Sitefinity team use the support center. In our Google Plus group you can find more than one thousand Sitefinity developers discussing different topics. For the Stack Overflow threads don’t forget to use the “Sitefinity” tag.
1 posts, 0 answered
  1. Nathalia
    Nathalia avatar
    25 posts
    16 Nov 2011
    14 Jun 2016
    Link to this post

    We had been creating pages and adding controls via API in our custom module during 
    Install/Upgrade for a while, but in this version when accessing the PageDraft.Controls Collections it shows warnings in the initialization window, although the process continue normally.

    In the below code you can see how we try to find a mvc control in a specific page, if it does not exist we add the control. This code is called from module upgrate method.

    public class OurCustomeModule : ModuleBase
        public override void Upgrade(Telerik.Sitefinity.Abstractions.SiteInitializer initializer, Version upgradeFrom)
                //Try to add custom controls to a page here

    The thing is a soon as the "Controls" collection is accessed it throws exceptions that appear in the initialization window as seen in the attachments.


    var pageManager = PageManager.GetManager();
    pageManager.Provider.SuppressSecurityChecks = true;
    Telerik.Sitefinity.Mvc.Proxy.MvcControllerProxy control = new Telerik.Sitefinity.Mvc.Proxy.MvcControllerProxy();
    control.ControllerName = controllerType.FullName;
    var pageNode = pageManager.GetPageNodes().Where(p => p.Id == pageId).SingleOrDefault();
    var pageControl = pageManager.CreateControl<PageDraftControl>(control, placeHolder);
    if (pageNode != null && pageControl != null)
        PageDraft temp = pageManager.EditPage(pageNode.PageId);
        if (temp != null)
            PageDraftControl controlfound = null;
            controlfound = temp.Controls.FirstOrDefault(ctrl => ctrl.ObjectType ==   pageControl.ObjectType && ctrl.Caption == pageControl.Caption);
            if (controlfound == null)
               temp = pageManager.PagesLifecycle.CheckIn(temp);
    pageManager.Provider.SuppressSecurityChecks = false;




1 posts, 0 answered