【问题标题】:Get DevExtreme DropDownBox Selected Values [closed]获取 DevExtreme DropDownBox 选定值 [关闭]
【发布时间】:2019-06-09 05:54:47
【问题描述】:

我在视图中使用多选 DevExtreme DropdownBox 并从模型中填充它 但我无法在 Post 方法的控制器中获取选定的值 如何读取选定的值?

【问题讨论】:

    标签: asp.net-core devexpress devextreme


    【解决方案1】:

    我得到了@Html.HiddenField,然后在下面的js函数中填充了隐藏字段值:

        function getSelectedItemsKeys(items) {
        var result = [];
        items.forEach(function (item) {
            if (item.selected) {
                result.push(item.key);
            }
            if (item.items.length) {
                result = result.concat(getSelectedItemsKeys(item.items));
            }
        });
        $("#myHF").val(result);
        return result;
    }
    

    然后通过视图模型将隐藏字段发送到控制器。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-11-25
      • 2021-05-24
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多