formcollection only holds the selected html.listbox items values? MVC

前端 未结 3 580
刺人心
刺人心 2020-12-29 08:38

My scenario is this: I have two listbox\'s, one that contains all my database items, and an empty one. The user adds the items needed from the full listbox to the empty list

3条回答
  •  情话喂你
    2020-12-29 09:40

    I am doing this as well, I think the way I solved it is a bit more elegant. Essentially I just have a Jquery function that runs before the form post that selects all the options.

        $(function () {
            $("form").submit(function (e) {
                $("#box2View option").attr("selected", "selected");
            });
        });
    

提交回复
热议问题