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.
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
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 toMvc
currently, change it toWebForms
. 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.
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
Hi Tom,
If you want to create your form in MVC you will need a surface controller :
https://our.umbraco.org/documentation/reference/routing/surface-controllers
You can also find some more information and examples here : http://creativewebspecialist.co.uk/2013/07/22/umbraco-mvc-what-on-earth-is-a-surface-controller/
http://24days.in/umbraco/2012/creating-a-login-form-with-umbraco-mvc-surfacecontroller/
http://carlosmartinezt.com/2014/06/umbraco-7-and-mvc-contact-form/
Dave
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/
Excellent. I'll take a look.
Thanks a lot guys.
is working on a reply...