How to connect a custom control to a macro, newbie question
Hi,
what are the exact settings to use a costum control in a macro. To get this clear this is not a user control and has NO ascx file.
I craeted a new VS-Project, compiled that, copied the dll to the bin folder of umbraco. (Like I did that for a user control, here everything is working fine.)
In the macro settings for a custom control I can enter values for an assembly and a type. Lets say the name of my assembly is HelloWorld.dll and the class name of the custom control is hello. What should I enter as values for (Assembly) and (Type) to get this to work? Do I have to do more then just copy the assembly?
I tried for the assembly: HelloWorld, HelloWorld.dll, bin/HelloWorld, bin/HelloWorld.dll
and for the type: hello, [empty].
in various combinations. But always get the error:
The following list shows the Public Properties from the
Control. By checking the Properties and click the "Save Properties" button at
the bottom, umbraco will create the corresponding Macro Elements.
System.NullReferenceException: Object reference not set to an instance of an object.
at umbraco.developer.assemblyBrowser.Page_Load(Object sender, EventArgs e)
it should be "HelloWorld" in the Assembly (the filename of the dll without extension) and "Hello" for the Type. Be sure that you have the full namespace added for the type, e.g. if the "Hello" class is in the namespace "HelloWorld" the fully qualified name you have to enter would be "HelloWorld.Hello".
How to connect a custom control to a macro, newbie question
Hi,
what are the exact settings to use a costum control in a macro. To get this clear this is not a user control and has NO ascx file.
I craeted a new VS-Project, compiled that, copied the dll to the bin folder of umbraco. (Like I did that for a user control, here everything is working fine.)
In the macro settings for a custom control I can enter values for an assembly and a type. Lets say the name of my assembly is HelloWorld.dll and the class name of the custom control is hello. What should I enter as values for (Assembly) and (Type) to get this to work?
Do I have to do more then just copy the assembly?
I tried for the assembly: HelloWorld, HelloWorld.dll, bin/HelloWorld, bin/HelloWorld.dll
and for the type: hello, [empty].
in various combinations. But always get the error:
------------------------------------------------------------------------------------------
Error reading HelloWorld
The following list shows the Public Properties from the Control. By checking the Properties and click the "Save Properties" button at the bottom, umbraco will create the corresponding Macro Elements.
System.NullReferenceException: Object reference not set to an instance of an object. at umbraco.developer.assemblyBrowser.Page_Load(Object sender, EventArgs e)
-----------------------------------------------------------------------------------------
The custom control is working, I tried this a another regular .NET project.
Cheers
Christian
it should be "HelloWorld" in the Assembly (the filename of the dll without extension) and "Hello" for the Type. Be sure that you have the full namespace added for the type, e.g. if the "Hello" class is in the namespace "HelloWorld" the fully qualified name you have to enter would be "HelloWorld.Hello".
hth, Thomas
Hi Thomas,
thanks for the help. This worked in the umbraco CMS, were my public property is now correctly recognized and no error shows up.
But when I put the macro on a template I get an error on a page:
Error loading customControl (Assembly: HelloWorld, Type: 'HelloWorld.hello'
What do I miss here?
Thanks
CHristian
Hmm, I do not have any problems using custom controls in templates.
Can you post your used code? or mail me: th |at| thoehler |dot| com
Thomas
Hi Thomas,
the problem is fixed. Now everything is working as expected. I made an error passing in the Properties. I appreciate your help.
Christian
glad that it is solved ;-)
is working on a reply...