Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Christian Liebe-Harkort 56 posts 104 karma points
    Jan 29, 2010 @ 09:55
    Christian Liebe-Harkort
    0

    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

  • Thomas Höhler 1237 posts 1709 karma points MVP
    Jan 29, 2010 @ 10:46
    Thomas Höhler
    1

    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

  • Christian Liebe-Harkort 56 posts 104 karma points
    Jan 31, 2010 @ 10:14
    Christian Liebe-Harkort
    0

    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

  • Thomas Höhler 1237 posts 1709 karma points MVP
    Jan 31, 2010 @ 23:51
    Thomas Höhler
    0

    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

  • Christian Liebe-Harkort 56 posts 104 karma points
    Feb 01, 2010 @ 10:34
    Christian Liebe-Harkort
    0

    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

  • Thomas Höhler 1237 posts 1709 karma points MVP
    Feb 01, 2010 @ 10:46
    Thomas Höhler
    0

    glad that it is solved ;-)

Please Sign in or register to post replies

Write your reply to:

Draft