Copied to clipboard

Flag this post as spam?

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


  • Dmitrij Jazel 86 posts 179 karma points
    Oct 17, 2015 @ 17:17
    Dmitrij Jazel
    0

    KnockoutJS and Umnraco @Html.EditorFor(m => profileModel.MemberProperties[i].Value) field

    Hi Guys, In my profile editor I have a field, like this one: @Html.EditorFor(m => pModel.MemberProperties[i].Value)

    That is basically a field that is beying generated within foreach loop. This example cam be found amond default Umbraco partials.

    Question: I want to add a knockoutJS "data-bind" attribute. And my goal is to be able to use something like this:

    @Html.EditorFor(m => pModel.MemberProperties[i].Value, new { data-bind = "value: ko_field" })
    

    But that does not really work. Obviously that in this case Umbraco Razor thinks that "data" wants to minus "field" variable or something like that, but "data_bind" does not work either.

    Q2) How about custom attributes for this @Html.Editor objects?

    Thanks for help! :)

    /Dmitrij

  • Dmitrij Jazel 86 posts 179 karma points
    Oct 17, 2015 @ 17:39
    Dmitrij Jazel
    0

    For example, found this nice article here: http://justthisguy.co.uk/umbraco-knockoutjs-forms-pt1/

    And attempted to do something like this:

    @Html.EditorFor(m => pModel.MemberProperties[i].Value, new { @class = "form-control", data_bind = "value: Name" })
    

    That should work, but to my surprise, it just don't. Any idea what am I doing wrong?

    /Dmitrij

Please Sign in or register to post replies

Write your reply to:

Draft