Copied to clipboard

Flag this post as spam?

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


  • Iain 8 posts 72 karma points
    Jan 06, 2010 @ 12:42
    Iain
    0

    Custom Controls using ITemplate

    Hi,

    I have a custom control which has an ITemplate Property to allow the html of the control to be edited by the Umbraco Users rather than hard coded into the control. It works perfectly in a normal .Net aspx page, but when I try and add it into Umbraco as a Macro I am running into problems.

    If I try to lay it out the same as in .Net:

    <umbraco:Macro Alias="MyControl" runat="server">
    <Layout>
    <h1>Testing</h1>
    </Layout>
    </umbraco:Macro>

    I get a Parser Error: "Type 'umbraco.presentation.templateControls.Macro' does not have a public property named 'Layout'."

    If I try and put the property inline (which isn't what I want it to do, but is what Umbraco tried to do by default):

    <umbraco:Macro Alias="MyControl" runat="server" 
    Layout="&amp;lt;h1&amp;gt;Testing&amp;lt;/h1&amp;gt;">
    </umbraco:Macro>

    I get the error "Invalid cast from 'System.String' to 'System.Web.UI.ITemplate'", as the property is being interpreted as Text by the Macro.

    Is it possible to use Templated Controls inside Umbraco?

    I am using Umbraco version v 4.0.2.1 and the Custom Control is in .Net 3.5.

    Many thanks,

    Iain

  • Dirk De Grave 4541 posts 6021 karma points MVP 3x admin c-trib
    Jan 06, 2010 @ 14:51
    Dirk De Grave
    1

    Iain, 

    You can't use it the way you're using it now, it's not supported (well, you know that already...)

    Instead, why can't you have your editors edit the html in a document property and pass that property value to the macro using the following syntax.

     

    If this is not what you're wanting, give us some example of use.

     

    Hope this helps.

    Regards,

    /Dirk

     

Please Sign in or register to post replies

Write your reply to:

Draft