Could not load type

Posted by Community Admin on 03-Aug-2018 18:57

Could not load type

All Replies

Posted by Community Admin on 25-Oct-2010 00:00

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 =)

Posted by Community Admin on 25-Oct-2010 00:00

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

Posted by Community Admin on 26-Oct-2010 00:00

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?

Posted by Community Admin on 26-Oct-2010 00:00

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

Posted by Community Admin on 26-Oct-2010 00:00

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
    

Posted by Community Admin on 26-Oct-2010 00:00

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.

This thread is closed