Copied to clipboard

Flag this post as spam?

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


  • Brendan Rice 538 posts 1099 karma points
    Jan 06, 2014 @ 01:34
    Brendan Rice
    0

    Best Practice for Populating DropDownLists

    Thanks for sharing the Hybrid Framework it has helped my understanding of MVC in the context of Umbraco.

    One thing I am struggling with is how to populate a model that is then passed down to a form. The reason I need to do this is that I have a number of drop down lists on a form that need populated from collections.

    You can see how I have my controller set up at the URL below:

    http://pastebin.com/9jYQ1iqp

    The problem that I having is that the page (http://.../my-action) never executes the code for the ActionResult MyAction. Instead the DefaultController is executed. This is where I am stuck.

    The code for my view is:

    http://pastebin.com/5y7yGCpZ

    I woudl really appreciate a little help, please.

     

  • Jeroen Breuer 4908 posts 12265 karma points MVP 4x admin c-trib
    Jan 06, 2014 @ 12:08
    Jeroen Breuer
    100

    Hello,

    Instead of doing a Html.Partial you should do a Html.Action. That goes to a controller where you can add the dropdownlist data and than return the partial view. The best practises has an Html.Action example for the donut caching on the contact page, but you can also use that for the form. The donut cache part can be disabled.

    Jeroen

  • Jeroen Breuer 4908 posts 12265 karma points MVP 4x admin c-trib
    Jan 09, 2014 @ 17:33
    Jeroen Breuer
    1

    Hello,

    Did you found a solution by trying Html.Action?

    Jeroen

  • Brendan Rice 538 posts 1099 karma points
    Jan 10, 2014 @ 00:24
    Brendan Rice
    0

    Hi Jeroen, the Hthml.Action worked perfrectly, thanks for the help.

Please Sign in or register to post replies

Write your reply to:

Draft