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

Forums / General Discussions / Could not load type

Could not load type

6 posts, 0 answered
  1. Philip Senechal
    Philip Senechal avatar
    69 posts
    Registered:
    07 Apr 2008
    25 Oct 2010
    Link to this post
    Can't seem to figure out the problem here. I created a new website in Sitefinity 4.0 BETA 2. I opened the website in Visual Studio 2010. I created a folder called Controls and in that, created a User Control called units.ascx that has a basic RadGrid in it. I added the User Control to my toolbox using the instructions here:

    http://www.sitefinity.com/40/help/developer-manual/controls-adding-a-new-control.html

    It appears in my toolbox with no problems. I created a page and used one of the standard templates. When I try to drag my control to one of the sections, I get the following error

    Could not load type 'SitefinityWebApp.Controls.units'

    Did I miss something when I was adding the control to my toolbox or creating the user control in VS?

    Thanks =)
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    16 Jun 2017
    25 Oct 2010
    Link to this post
    Hello Philip,

    Most probably the ControlType is not correct are there is some logic in your control that does not work properly.

    Kind regards,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. Philip Senechal
    Philip Senechal avatar
    69 posts
    Registered:
    07 Apr 2008
    26 Oct 2010
    Link to this post
    Well it can't be my control because I created a new one and left it COMPLETELY blank and I still get the same error.

    Are the directions I followed in the documentation missing something? Or do my user controls need to be in a certain place in the directory structure. I tried placing them in the root of the website and under a sub-folder called Controls and got the same error with both. The error appears as soon as I drag the control from the Toolbox to the page.

    Since it's a user control, I'm specifying the ControlType and LayoutTemplate as ~/Controls/units.aspx since that's what it says in the documentation. Is that correct? I'm leaving ResourceClassId and ModuleName blank...is that correct?

    Any help you can provide is appreciated.

    UPDATE: So I was playing around and it turns out that the problem was because I created the user control in a folder named Controls that I had added. When I created the control in the root (not moved there, but created there), it works fine. Is that what has to be done? Create user controls in the root and then move them to a folder for organization?
  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    16 Jun 2017
    26 Oct 2010
    Link to this post
    Hi Philip,

    There should not be a problem to create the control inside a folder or directly in the root. The problem is that the type you added was not correct. The control can be added to each folder or it could be a class library.

    All the best,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  5. Philip Senechal
    Philip Senechal avatar
    69 posts
    Registered:
    07 Apr 2008
    26 Oct 2010
    Link to this post
    Hi Ivan,

    Thanks for the reply...

    This must be where my disconnect is with the new version. In 3.7, I just created a new Web User Control and it worked fine...I could drag it to a Sitefinity Page and it worked. What do you mean when you refer to Type? I was under the assumption that my type was System.Web.UI.UserControl? Do I need to create them as a different type? Do I declare that in the code behind similar to this? Is there another or additional places in my user control that I have to declare the type? Does the SDK have examples of user controls? Perhaps I should download that and look at some examples.

    namespace SitefinityWebApp
    {
        public partial class units : System.Web.UI.UserControl
        {
  6. Philip Senechal
    Philip Senechal avatar
    69 posts
    Registered:
    07 Apr 2008
    26 Oct 2010
    Link to this post
    I was following your instructions from another post I had made regarding a compiled and published site not working. I added references to all the .dll files in the bin folder and now my user control seems to be working fine. I suppose I ought to go through the bin folder and figure out what I need and remove the rest.

    Thanks for the assistance.
6 posts, 0 answered