Breaking Changes - sf:my-user-control

Posted by Community Admin on 04-Aug-2018 01:43

Breaking Changes - sf:my-user-control

All Replies

Posted by Community Admin on 14-May-2011 00:00

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.

Posted by Community Admin on 18-May-2011 00:00

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";
var brokenDraftControls = pageManager.GetControls<PageControl>().Where(c => c.ObjectType.Contains("some-user-control.ascx"));
foreach (PageControl brokenDraftControl in brokenDraftControls)
    brokenDraftControl.ObjectType = "~/UserControls/someusercontrol.ascx";

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

Posted by Community Admin on 18-May-2011 00:00

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

This thread is closed