Copied to clipboard

Flag this post as spam?

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


  • Jason 17 posts 37 karma points
    Jul 06, 2015 @ 12:54
    Jason
    0

    Lost trying to create MVC macros - could use some guidance!

    Hello all,

    I've been fighting with this for a few days and I'm just not sure where to go anymore.

    Basically I'm trying to create a macro that is used to display data on a page. Seems simple enough; I can do it in several languages right now. :) Part of the problem for me is I'm new to Umbraco, MVC, and C#. In some cases, I'll want to submit a form.

    For example, I'm working on one that needs to pull data from the DB and populate a dropdown. The user will select the category, submit a form, and then it'll populate two more dropdowns with data dependent upon the first one. In the end, the final form submission will roll everything up and display a set of search results.

    I have things working on two ends. One, I followed the tutorial from a course and got a contact form working in MVC as a macro. I tried using the same approach to my form, and what I can't figure out there is how to get data to populate on the initial page load. I read up on routing, but creating an index method in my controller didn't work.

    On the other side, I can get an MVC project to compile and work fine (where each actions have their own views in folders with the same name, etc), but I can't get it to work within Umbraco. I thought maybe I could take my view and turn it into a partial, and just include it in the macro page, but that doesn't work either.

    I feel like I have two pieces to the equation but can't put them together to get what I need. Do you have any recommendations on where to go next? Has anyone put together a tutorial on how to put together an MVC macro that loads some stuff on intial page view and has some form interaction?

    Thanks for your advice.

    Cheers, -jason

  • Ismail Mayat 4511 posts 10092 karma points MVP 2x admin c-trib
    Jul 06, 2015 @ 13:58
    Ismail Mayat
    0

    Jason,

    Take a look at the excellent hybrid mvc framework starter kit plenty of good stuff in there in working with umbraco and mvc.

    Regards

    Ismail

  • Jason 17 posts 37 karma points
    Jul 07, 2015 @ 13:46
    Jason
    0

    Awesome, thanks for that, Ismail! I'm opening up the Hybrid solution right now and watching the video. :)

    -j

Please Sign in or register to post replies

Write your reply to:

Draft