Copied to clipboard

Flag this post as spam?

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


  • Tom Cowling 144 posts 342 karma points
    Mar 14, 2016 @ 16:31
    Tom Cowling
    0

    Problems with mixed technologies

    Hi,

    I have mostly developed on umbraco 6 sites and want to copy across some code I have used previously to an Umbraco 7 site.

    I have a usercontrol to create a form - this is built using aspx and works just fine. On an Umbraco 6 site, I usually add a macro and wrap it in a

    tag and off the form goes.

    For some reason, it's not submitting on my Umbraco 7 site. When I hit submit, it posts back to the page, but doesn't do anything. If I use a <form runat="server"> tag, it puts it in the body of the page as a literal tag (because it's using MVC I guess?) Is there any way I can recycle my ASPX usercontrol without having to rewrite it in MVC?

    There are no errors produced. I've checked the SMTP details in my web.config and they're fine. I've added any dll files to the bin folder, so that's all fine too. Just not sure where to look for an answer to this..

    Thanks,

    Tom

  • Sebastiaan Janssen 4941 posts 14780 karma points MVP admin hq
    Mar 14, 2016 @ 18:33
    Sebastiaan Janssen
    100

    The problem is that you're trying to use WebForms code in MVC templates.. not going to work. You'll need to set up your templates as masterpages.

    First of all, go into umbracoSettings.config and find defaultRenderingEngine - this is set to Mvc currently, change it to WebForms. Now, this doesn't actually do very much, the only thing it really does: when you create a new template from the backoffice, it creates a masterpage now instead of an MVC view.

    You will need to one by one delete the MVC templates you have now and re-implement them by re-creating them. So: delete the MVC template, create a new template (likely with the same name), put your WebForms code in there. This also means you'll have to reset all your document types, when you delete a template, the document type also doesn't have this template any more, so make sure to set up the new WebForms template as the template for your document type.

    Hopefully you haven't set up too much yet for the site you're working on, then it will be a bit easier to recreate the templates.

  • Tom Cowling 144 posts 342 karma points
    Mar 15, 2016 @ 09:41
    Tom Cowling
    0

    I was afraid you'd say that. I was more of a post build requirement.

    I'll take a look at building an MVC one. Seems like it will be a lot less hastle!

    T

  • Dave Woestenborghs 3342 posts 11276 karma points MVP 6x admin c-trib
    Mar 15, 2016 @ 09:51
  • Sebastiaan Janssen 4941 posts 14780 karma points MVP admin hq
    Mar 15, 2016 @ 10:32
    Sebastiaan Janssen
    0

    And another blog post that we've used on the umbraco courses in the past for a better understanding of what's going on: https://umbraco.com/follow-us/blog-archive/2013/7/14/moving-from-webforms-to-mvc/

  • Tom Cowling 144 posts 342 karma points
    Mar 15, 2016 @ 12:44
    Tom Cowling
    0

    Excellent. I'll take a look.

    Thanks a lot guys.

Please Sign in or register to post replies

Write your reply to:

Draft