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?
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
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
Awesome, thanks for that, Ismail! I'm opening up the Hybrid solution right now and watching the video. :)
-j
is working on a reply...