Copied to clipboard

Flag this post as spam?

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

  • Richard Terris 273 posts 715 karma points
    Apr 09, 2011 @ 23:55
    Richard Terris

    Hi guys

    I'm an Umbraco noob here but I'm sure I'm probably not the first person who's asked this - I just can't find anything on it...

    I have a contact form on a page with a submit button on it, nothing complicated, just emails a mailbox.

    So using Visual Studio it works as expected, but obviously when I move to Umbraco there is no contact.aspx.cs file with code for the button click event.

    My question is, where do I handle this event in Umbraco? Is it possible to have code behind files? Or do I need to use Macros?

    If anyone can point me in the right direction I'll be much obliged.

  • Daniel Bardi 927 posts 2562 karma points
    Apr 10, 2011 @ 00:44
    Daniel Bardi

    Place uncompiled code file in the App_Code folder.. standard procedure.

    As a side note, I would recommend placing your form in a usercontrol and wrapping in a macro.

  • Sascha Wolter 615 posts 1101 karma points
    Apr 10, 2011 @ 08:26
    Sascha Wolter

    Hi richard terris,

    +1 for Daniel's suggestions to wrap the funcitonality in a usercontrol, then either just wrap it in a macro or directly put it on the template (like you would with any other ASP.Net user control and aspx page).

    You can of course create code-behind files as well if you so wish, I made a blog post about how that works here



  • Daniel Bardi 927 posts 2562 karma points
    Apr 10, 2011 @ 08:58
    Daniel Bardi

    +1 where?  :P

    I rarely place uncompiled code in App_Code.. I compile an assembly for everything...  that's how I roll.

  • Simran 2 posts 22 karma points
    Mar 24, 2014 @ 21:07

    Sascha, you reference your blog spot that explains how to ceate code-behind files. Can you please resend the link as the one above goes to an unknown page. 



Please Sign in or register to post replies

Write your reply to: