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

Forums / Bugs & Issues / Custom control error: 'Type "xxx" cannot be resolved'

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

4 posts, 1 answered
  1. Neil
    Neil avatar
    26 posts
    Registered:
    03 Aug 2011
    28 Jul 2014
    Link to this post

    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.

  2. Neil
    Neil avatar
    26 posts
    Registered:
    03 Aug 2011
    29 Jul 2014 in reply to Neil
    Link to this post

    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

    Answered
  3. Shriyal
    Shriyal avatar
    2 posts
    Registered:
    25 May 2016
    19 Aug in reply to Neil
    Link to this post

    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.

  4. Neil
    Neil avatar
    26 posts
    Registered:
    03 Aug 2011
    11 Nov
    Link to this post

    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.

4 posts, 1 answered