Copied to clipboard

Flag this post as spam?

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


  • Eunice 1 post 21 karma points
    Dec 29, 2009 @ 15:52
    Eunice
    0

    How to access a .net user control in umbraco page?

    Hi,

    I am pretty new to Umbraco. I have a problem. I have two macros each comes from a .net User Control. User Control A has a delegate Click event that should be defined in the parent aspx page which then will update data source in User Control B.

    It should be easy doing this in normal aspx page. But how do you do that in Umbraco?

    I have used the FindControlRecursive method (i got it from http://forum.umbraco.org/yaf_postst9889_Update-another-UserControl-from-another-Usercontrol.aspx) to get the Control but it seems like the method is returning a Macro class which cannot be casted into my UserControl object. In that case I cannot access the event i have inside the usercontrol codebehind.

    I also read in this thread http://our.umbraco.org/forum/developers/extending-umbraco/4103-Communication-between-page-and-usercontrol?p=1

    that creating a custom masterpage that has these usercontrols and modify the page directive to inherit from that master page was actually solving this similar problem (or at least that's what i thought).

    But I dont know how do you set the page directive in umbraco?

    I really appreciate your feedbacks :)

  • Aaron Powell 1708 posts 3046 karma points c-trib
    Dec 29, 2009 @ 23:34
    Aaron Powell
    0

    Personally I wouldn't both with trying to find the user control in the macro as you'd quite possibly end up with a very brittle control hierachy expectation.

    I'd look into having a framework handle this on your behalf. The ASP.NET Web Forms MVP framework has such a feature, it's called cross-presenter messaging and you can see a video of it in action here - http://wiki.webformsmvp.com/index.php?title=Feature_walkthroughs

Please Sign in or register to post replies

Write your reply to:

Draft