Asp.net mvc 剑道网格内联下拉列表不发送默认值

Asp.net mvc 剑道网格内联下拉列表不发送默认值,asp.net-mvc,kendo-grid,Asp.net Mvc,Kendo Grid,我有一个剑道格网,我想在那里添加一条新线。网格中有一个下拉列表,用于限制用户不使用数据库中以外的任何内容。整个过程都很好,但当我尝试添加新行或编辑行,并且没有从下拉列表中选择值时,剑道发送空值。。只有当我更改下拉列表时,它才会发送值,但至少它应该发送默认值或当前值 $("#HoleGrid").kendoGrid({ dataSource: { transport: { read: {

我有一个剑道格网,我想在那里添加一条新线。网格中有一个下拉列表,用于限制用户不使用数据库中以外的任何内容。整个过程都很好,但当我尝试添加新行或编辑行,并且没有从下拉列表中选择值时,剑道发送空值。。只有当我更改下拉列表时,它才会发送值,但至少它应该发送默认值或当前值

$("#HoleGrid").kendoGrid({

        dataSource: {

            transport: {

                read: {
                    url: "SignOff/GetHoleData",
                    type: "POST",
                    datatype: "json",
                    contentType: "application/json"
                },
                update: {
                    url: "SignOff/UpdateHoleData",
                    contentType: "application/json; charset=utf-8",
                    type: "POST",
                    dataType: "json",
                },
                create: {
                    url: "SignOff/CreateHoleData",
                    contentType: "application/json; charset=utf-8",
                    type: "POST",
                    dataType: "json"
                },
                parameterMap: function (HoleData, operation) {
                    if (operation != "read") {
                        return kendo.stringify(HoleData.models);
                    }
                }
            },

            serverPaging: false,
            pageSize: 5,
            batch: true,

            schema: {
                model: {
                    id: "ID",
                    fields: {
                        ID: { editable: false },
                        Hole: { editable: true, nullable: false },
                        From: { type: "number", validation: { required: true, min: 0 } },
                        To: { type: "number", validation: { required: true, min: 0 } },
                        Total: { editable: false },
                        Hours: { type: "number", validation: { min: 0, required: true } },
                        Bit: { defaultValue: { CategoryID: "BQ", CategoryName: "BQ" } },
                        Size: { editable: true, nullable: true },
                        TypeOfDrilling: { defaultValue: { CategoryID: "DIA", CategoryName: "DIA" } }
                    }
                },
                errors: "Errors"
            },

            error: function (e) {
                alert(e.errors + "HoleGrid");
            }
        },

        editable: "inline",
        pageable: {
            refresh: true,
            pageSizes: true
        },
        toolbar: ["create"],
        sortable: true,
        autoBind: false,

        columns:
            [
                { field: "Hole", width: 90, title: "Hole" },
                { field: "From", width: 90, title: "From" },
                { field: "To", width: 90 },
                { field: "Total", width: 70, title: "Total" },
                { field: "Hours", width: 90, title: "Hours" },
                { field: "Bit", width: 80, title: "Bit#", values: BitSize },
                { field: "Size", width: 80, title: "Bit Size" },
                { field: "TypeOfDrilling", width: 80, title: "Type", values: Types },
                { width: 175, command: [{ name: "edit", text: { edit: "Edit", update: "Update", cancel: "Cancel" } }], title: "Action" },
            ]
    });
});


var BitSize = [
        { value: 'BQ', text: 'BQ' },
        { value: 'NQ', text: 'NQ' },
        { value: 'HQ', text: 'HQ' },
        { value: 'PQ', text: 'PQ' },
        { value: 'RC', text: 'RC' },
        { value: 'GC', text: 'GC' }
];

var Types = [
        { value: 'DIA', text: 'DIA' },
        { value: 'RC', text: 'RC' },
        { value: 'GC', text: 'GC' }
];
这是我的Html

<div class="box-content">
     <p>Holes</p>
     <div id="HoleGrid"></div>
     <div class="clearfix"></div>
</div>

我哪里做错了??请帮忙。

我找不到任何解决办法。所以我所做的是,在代码中检查它是否为null,然后手动将默认值放入其中

public ContentResult UpdateHoleData(List<HoleViewModel> Holes)
        {            

if (Holes != null && Holes.Count > 0)
                {                    
                        if (Holes[0].Size == null)
                        {
                            Holes[0].Size = "RC";
                        }

                        if (Holes[0].TypeOfDrilling == null)
                        {
                            Holes[0].TypeOfDrilling = "DIA";
                        }
}
return null;
        }
删除下拉列表的默认值

public class HoleViewModel
    {
        public string ID { get; set; }
        public string Angle { get; set; }
        public string Area { get; set; }
        public string Azimuth { get; set; }
        public string Bit { get; set; }
        public string Condition { get; set; }
        public string From { get; set; }
        public string GPS { get; set; }
        public string Hammer { get; set; }
        public string Hole { get; set; }
        public string HoleCondition { get; set; }
        public string Hours { get; set; }
        public string ProgressiveTotal { get; set; }
        public string Purpose { get; set; }
        public string RunSheetBitList { get; set; }
        public int SiteID { get; set; }
        public string Size { get; set; }
        public string Status { get; set; }
        public string To { get; set; }
        public string Total { get; set; }
        public string TypeOfDrilling { get; set; }
    }
public ContentResult UpdateHoleData(List<HoleViewModel> Holes)
        {            

if (Holes != null && Holes.Count > 0)
                {                    
                        if (Holes[0].Size == null)
                        {
                            Holes[0].Size = "RC";
                        }

                        if (Holes[0].TypeOfDrilling == null)
                        {
                            Holes[0].TypeOfDrilling = "DIA";
                        }
}
return null;
        }
   schema: {
            model: {
                id: "ID",
                fields: {
                    ID: { editable: false },
                    Hole: { editable: true, nullable: false },
                    From: { type: "number", validation: { required: true, min: 0 } },
                    To: { type: "number", validation: { required: true, min: 0 } },
                    Total: { editable: false },
                    Hours: { type: "number", validation: { min: 0, required: true } },
                    Bit: { },
                    Size: { editable: true, nullable: true },
                    TypeOfDrilling: { } }
                }
            },