Copied to clipboard

Flag this post as spam?

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


  • Steven 33 posts 166 karma points
    May 13, 2013 @ 16:23
    Steven
    0

    Custom Web User Control Events - getting crazy

    Hi Folks,

    I thought I'd quickly create a custom web control for some new functionality and run that within my Umbraco 6.0.5 installation ... ( that would be my first control on that site ).

    Right ... So I created the control, wrapped it around in a macro and added the macro somewhere in one of my document types editor content ... the control is nicely rendered ... but when I click on the button then the event is not fired ... I am getting back in the 'page load' event method with 'postback' on false ... puzzled ...

    I am wrapping stuff around a form with runat="server" and there is only 1 form

    After checking options, try finding similar issues on this forum and others, rereading my knowledge on viewstates, etc ( I admit my .net web coding skills are a bit 'rusty' ) I am not sure anymore where to find the problem ...

    As a test case I tried a couple of other things:

    1) Created a quick straight-forward .net web site ... the user control works as expected ... button event is nicely fired and picked up

    2) Added the macro to my main master page ... works as expected !

    3) Add the macro to any child page ... doesn't work anymore ...

    4) Moved the form away from the master into the child ... doesn't work anymore ...

    I am using WebMatrix 3 with integrated IIS Express ... ( Classic mode didn't change anything either )

    Anyone any hints ?

    Thanks,

    Steven

  • Jan Skovgaard 11280 posts 23678 karma points MVP 10x admin c-trib
    May 13, 2013 @ 21:15
    Jan Skovgaard
    0

    Hi Steven

    Are you by any chance running MVC mode rather than webforms mode?

    User controls can be rendered in MVC mode but it's not possible to post forms etc.

    /Jan

  • Steven 33 posts 166 karma points
    May 14, 2013 @ 09:52
    Steven
    0

    Hi Jan,

    The site is still running in 'webforms' mode ... but thanks for that potential pointer ... I didn't check the config file until now ...

    I reckon if I would be running in MVC mode then the whole site would not work as all my templates are still webforms based ...

    Could this be a potential new issue with version 6 and master pages due to the added MVC functionality ?

    Thanks,

    Steven

  • Steven 33 posts 166 karma points
    May 15, 2013 @ 14:07
    Steven
    0

    I did some more testing ... a couple observations:

    1) I referenced the macro within my master page and within a child page so the macro is rendered twice on the same page ... the one on the 'outside' ( so to speak ) runs fine .. the one on the 'inside' doesn't ...

    2) I had a backup copy of my site running on 4.9.0 so I installed the usercontrol there as well and did the same test ... there the usercontrol works as expected within the child page...

    This must be a bug on 6.0.5 ...

    Regards,

    Steven

  • Steven 33 posts 166 karma points
    May 15, 2013 @ 17:16
    Steven
    0

    Some further digging lol ... 

    A crucial part which I overlooked from my end is that the custom control macro is actually embedded as an inline macro in some documetn type content field ... which is displayed again by a razor script in a child page ...

    So basically

    Master Page

    -> Child Page

    -> Razor Macro

    ->  Model.Property containing embedded custom control macro

     

    This seems to be discussed as well in an older posting - http://our.umbraco.org/forum/developers/razor/21275-Rendering-RTE-with-embedded-macros-in-Razor - but for me at least the user control is rendered ... it is simply not getting its event ...

    Steven

Please Sign in or register to post replies

Write your reply to:

Draft