Loading Custom Controls From An Assembly Options
RobertDougan
Posted: Saturday, July 19, 2008 1:54:37 PM
Rank: Newbie

Joined: 7/17/2008
Posts: 6
Location: Glasgow
Apologies if this question has been asked/answered before, but I couldn't find anything on the net or the forum.

I'm trying to load in a custom control from my own DLL to use in Umbraco.

To achieve this I have added my DLL to the GAC and added a reference to the assembly in my web.config.

I then created a new Macro, chose the .NET Custom Control option and set the assembly reference to MyAssembly and the type reference to MyAssembly.Controls.MyControl.

However, when I try to use the control on the template it just will not load and I get the error message:

Unable to get type MyAssembly.Controls.MyControl from assembly MyAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=6e8635c3814d7f46.

Am I doing something wrong?

Cheers in advance.
fdo
Posted: Sunday, July 20, 2008 2:16:09 PM

Rank: Enthusiast

Joined: 6/7/2007
Posts: 27
Location: Copenhagen, Denmark
Copy and paste from an old pdf file about usercontrols:

"First you need to copy your control. Whether it’s a usercontrol or a customcontrol
you’ll need to copy the assembly (dll) into the /bin folder of your umbraco
installation. If it’s a UserControl you’ll need to copy the .ascx file as well. Your install
already contains a /usercontrols folder which we’ll recommend that you use, but
you’re free to place them anywhere in your application.

Example
We have a usercontrol called HelloWorld written in Visual Basic.NET containing a
Textbox and a button. What we need is the HelloWorld.ascx file and the HelloWorld.dll.

We’ll copy HelloWorld.ascx into /usercontrols/HelloWorld.ascx and HelloWorld.dll
will go into /bin/HelloWorld.dll. Now we’re ready to register the usercontrol into
umbraco using a macro."

Thats it!

/Finn
RobertDougan
Posted: Sunday, October 05, 2008 1:47:37 PM
Rank: Newbie

Joined: 7/17/2008
Posts: 6
Location: Glasgow
Hi,

Sorry I didn't follow this up. Thanks for your response.

The answer you gave relates to user controls rather than custom .NET controls. I have actually given up trying to load in custom controls and am now using user controls instead.

Not a big deal in the long run I guess!

Thanks again for the suggestion.

Cheers,
Robert
Users browsing this topic
Guest


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.