【问题标题】:Kendo Grid edit popup complex model submitting剑道网格编辑弹出复杂模型提交
【发布时间】:2014-07-27 11:14:38
【问题描述】:

我正在尝试使用带有 Kendo 网格编辑弹出窗口的复杂模型。提交 ALResults 对象属性时始终为空。当我不使用剑道时,它工作得很好。剑道复杂模型提交有问题吗?

public class InitialApplicantLevel2Model
    {
        public InitialApplicantLevel2Model()
        {

            alResultsModel = new ALResults();
        }

        public int InitialApplicantLevel2ID { get; set; }
        public string ApplicantName { get; set; }
        public string ContactNumber { get; set; }
        public string School { get; set; }

        [Required(ErrorMessage="Ref No. required.")]
        public int? EnquiryID { get; set; }



        public ALResults alResultsModel { get; set; }




    }

public class ALResults
    {
        public int ResultsID { get; set; }
        public int InitialApplicantLevel2ID { get; set; }
        public string Stream { get; set; }
        public string Grading { get; set; }
        public string IndexNo { get; set; }
        public int? Year { get; set; }
        public int? Attempt { get; set; }
        public double? ZScore { get; set; }
        public string Medium { get; set; }
    }



@model SIMS.Models.StudentIntake.InitialApplicantLevel2Model 
<tr>
        <td>Year: </td>
        <td>@Html.TextBoxFor(o=>o.alResultsModel.Year)</td>
        <td>Index No: </td>
        <td>@Html.TextBoxFor(o=>o.alResultsModel.IndexNo)</td>
        <td>Medium: </td>
        <td>@Html.TextBoxFor(o=>o.alResultsModel.Medium)</td>
    </tr>
    <tr>
        <td>Stream: </td>
        <td>@Html.TextBoxFor(o=>o.alResultsModel.Stream)</td>
        <td>Attempt: </td>
        <td>@Html.TextBoxFor(o=>o.alResultsModel.Attempt)</td>
        <td>Zscore: </td>
        <td>
      @Html.TextBoxFor(o=>o.alResultsModel.ZScore)

        </td>
    </tr>

【问题讨论】:

    标签: asp.net-mvc kendo-ui kendo-grid


    【解决方案1】:

    我找到了答案here

    不幸的是,Kendo UI 不支持类组合/视图模型 包含复杂对象,您的视图模型需要完全 flat 以避免意外行为。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-07-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-01-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多