Copied to clipboard

Flag this post as spam?

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


  • bob 19 posts 39 karma points
    Jul 14, 2011 @ 03:41
    bob
    0

    Using plain (non-macro) .net control

    Hi,

    I wanted to be able to use a custom .NET control directly in one of my master pages but it seemed that the only way I could get it to work was as an Umbraco macro.

    i.e. I had created a user control and I wanted to use it in a master page via mark-up either by registering the control with an @Register tag on the master page or by adding the control in the 'pages > controls' section in web.config. But trying those approaches, the control was not successfully added to the page. Only after creating a macro from the control and the using the macro could I get it onto the masterpage. In this case it seems that the Umbraco macro is being a bit of an uneccessary middle-man since the control that I made is not intended to be used in the richtext editor.

    So is it possible to use a custom .net control directly in this way or do they always have to be converted into macros to be used?

    Thanks.

  • Peter Gregory 408 posts 1614 karma points MVP 3x admin c-trib
    Jul 14, 2011 @ 04:42
    Peter Gregory
    0

    Hi Bob

    It is totally possible to put a control directly on your masterpages without wrapping in a Macro.   As they are just standard masterpages they should just work and I have done this many times in the past when I do not need to wireup with Umbraco features. So it appears that you may have other problems with your configuration that are not obvious from your description above.

    The advantages of using a Macro are as you say already, the ability to insert them into the RTE, pass Macro Parameters (Page properties etc) without needing to make uneccessary API calls from your usercontrol, and to take advantage of the built in caching in Umbraco.

    Peter

Please Sign in or register to post replies

Write your reply to:

Draft