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

Forums / Bugs & Issues / Breaking Changes - sf:my-user-control

Breaking Changes - sf:my-user-control

3 posts, 1 answered
  1. Jaime Weise
    Jaime Weise avatar
    120 posts
    Registered:
    02 Nov 2008
    14 May 2011
    Link to this post
    My User Controls that I registered in the toolbox are broken
    Once you install 4.1 your user controls that you registered in the toolbox all break if you used hyphens in the paths. 

    ex: ~/UserControls/some-user-control.ascx

    If you had this registered in your toolbox your application will be broken when you upgrade to 4.1.
  2. Radoslav Georgiev
    Radoslav Georgiev avatar
    3370 posts
    Registered:
    01 Feb 2016
    18 May 2011
    Link to this post
    Hi Jaime Weise,

    My bad. There is a problem and it comes by the fact that the class naming in .NET does not allow hypens to be used. When we are registering user controls to the page we create a tag sf:UsercontrolName. What you will have to do is

    1) Go to the ToolboxesConfig.config file under ~/App_Data/Sitefinity/Confiturations/ and change the control type attribute of your user controls not to use hyphens.
    2) Rename the your user control files so that they do not use those hyphens.
    3) Run a script similar to the bellow one to fix controls added to pages:
    var pageManager = PageManager.GetManager();
    var brokenControls = pageManager.GetControls<PageControl>().Where(c => c.ObjectType.Contains("some-user-control.ascx"));
    foreach (PageControl brokenControl in brokenControls)
    {
        brokenControl.ObjectType = "~/UserControls/someusercontrol.ascx";
    }
    pageManager.SaveChanges();
     
    var brokenDraftControls = pageManager.GetControls<PageControl>().Where(c => c.ObjectType.Contains("some-user-control.ascx"));
    foreach (PageControl brokenDraftControl in brokenDraftControls)
    {
        brokenDraftControl.ObjectType = "~/UserControls/someusercontrol.ascx";
    }
    pageManager.SaveChanges();


    Kind regards,
    Radoslav Georgiev
    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
    Answered
  3. Jaime Weise
    Jaime Weise avatar
    120 posts
    Registered:
    02 Nov 2008
    18 May 2011
    Link to this post
    Sure, but this should be fixed in future versions. It is pretty annoying since I have about 30 controls where the folders and control names are all hyphenated.

    This worked before 4.1

    I will try the script
3 posts, 1 answered