Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
I understand this is probably the most basic of basic questions but I really need pointing in the right direction!
I have spent the last 6 years working on U 4 - 6 with c#, macros and xslt and standard webforms.
I have now been handed an Umbraco 7 project and although I have dabbled in tiny bits of Umbraco 7 I have never created anything equivalent to a usercontrol macro.
I want to do what seems like the simplest thing..
The "usercontrol" loads, checks a few things server side and depending what it finds presents the user with some different options in the form of buttons or a drop down list, and when they click one it does some more server side stuff and stores a cookie.
So far I've got all the checking serverside stuff directly in a partialview/cshtml file and showing some buttons but I can't work out the click events of the buttons.. I think I need a controller with actions but I don't understand how I link it all together.
Is there a really simple tutorial somewhere on this?
I have found this:
but it's such a different way of working I'm totally confused and don't really understand where to start!
Thanks for any help
If you want to do this serverside you have found the right way. Surfacecontrollers are the way to go. Yet, can be hard to understand at the beginning. If it is to extend the umbraco backend, then other ways have emerged, the mantra became: think AngularJS and API calls.
I would suggest you start with a "dirty" way of figuring out what this MVC exactly does.
Let say, take a form
<input type="text" name="fieldname" /> <input type="submit" value="send" />
you could on the same (partial) view add some simple code to interact with this:
If you put this into a partial you have replaced your usercontrol for 90%...
I will get death threats from showing you such a horrible way. Entering the world of MVC. Split the Controller (c# code) from the View (Razor template). And that is the reason of existence for Surface Controllers.
To answer your question very short... Try this tutorial from the getting started section in the documentation: creating forms
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted