Custom control error: 'Type "xxx" cannot be re

Posted by Community Admin on 04-Aug-2018 15:21

Custom control error: 'Type "xxx" cannot be resolved'

All Replies

Posted by Community Admin on 28-Jul-2014 00:00

I wanted to be able to limit the categories that the Category widget displays (by default all of them) and I found this -

, which sounded good.  So I took this code and followed the instructions from here - (I changed the name of the namespace to SubCategoryWidget and the name of the code file to SubCategory), and then here -

However, when I drag the newly created control onto a page I get the error 'Type  "SubCategoryWidget.SubCategory" cannot be resolved''.  The cause seems fairly obvious in that the control cannot be found, so I tried changing the ControlType  to ~/SubCategoryWidget.SubCategory; /SubCategoryWidget.SubCategory  and other variations without success.

I still think it's probably a simple thing that's causing the problem, but I can't see what it is.  Can anyone help?

BTW, Our site is using VB.NET, so I have converted the C# code.

Cheers.

Posted by Community Admin on 29-Jul-2014 00:00

Got there in the end.  When registering the control, in the ​​Control CLR Type or Virtual Path ​field the format needed to be ​ProjectName.NameSpace.CodeFileName

Posted by Community Admin on 19-Aug-2016 00:00

Can you give a concrete example? 

I have web-project named SitefinityWebApp. I added CustomWidgets/LibrarySelector and then added file MyLibrarySelector.ascx. The .cs shows namespace to be SitefinityWebApp.LibrarySelector.

I tried following combinations:

~/Sitefinity/CustomWidgets/LibrarySelector/SitefinityWebApp.SitefinityWebApp.LibrarySelector.MyLibrarySelector.ascx

~/CustomWidgets/LibrarySelector/SitefinityWebApp.SitefinityWebApp.LibrarySelector.MyLibrarySelector.ascx

~/SitefinityWebApp.SitefinityWebApp.LibrarySelector.MyLibrarySelector.ascx

~/SitefinityWebApp.LibrarySelector.MyLibrarySelector.ascx

SitefinityWebApp.SitefinityWebApp.LibrarySelector.MyLibrarySelector.ascx

SitefinityWebApp.LibrarySelector.MyLibrarySelector.ascx

And all of the above without namespace before I got to this thread.

Thanks.

Posted by Community Admin on 11-Nov-2016 00:00

Hi Shriyal,

I've only just seen your question so this is probably way too late.

I just created a class, not a user control,  so as you're using an ascx file you just need to add in the path to that file e.g. ~/CustomWidgets/LibrarySelector/MyLibrarySelector.ascx.

This thread is closed