asp.net-core - 获取 DevExtreme DropDownBox 选定的值

标签 asp.net-core devexpress devextreme

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

最佳答案

我得到了一个@Html.HiddenField,然后在下面的js函数中填充了hiddenfield值:

    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;
}

然后通过 View 模型将隐藏字段发送到 Controller 。

关于asp.net-core - 获取 DevExtreme DropDownBox 选定的值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56512321/

相关文章:

asp.net-core - “HttpRequest”不包含 'EnableRewind' 的定义

c# - .NET Core Web API 中的 OData 列表/字典序列化

c# - 从后面的代码中隐藏 ASPxPopupControl

javascript - .net框架升级到6.0后js文件抛出错误

.net - 从 Controller 返回 XDocument (dotnet coreclr)

.net - 有什么方法可以确定用户在 WebBrowser.ShowDialog() 中单击了打印还是取消?

delphi - 刷新 cxGrid 中的颜色

javascript - Windows Azure + DevExpress(手机)获取待办事项列表(标准示例)

C#:如何将 HTML5/CSS3 转换为 PDF 文档?

asp.net-core - .NET Core MVC 页面更改后不刷新