Kendo ui Kendo MVC网格创建的弹出编辑器模板中的模型为空,无默认值

Kendo ui Kendo MVC网格创建的弹出编辑器模板中的模型为空,无默认值,kendo-ui,kendo-grid,kendo-asp.net-mvc,telerik-grid,telerik-mvc,Kendo Ui,Kendo Grid,Kendo Asp.net Mvc,Telerik Grid,Telerik Mvc,我有一个剑道MVC层次结构网格。为了便于阅读,我的示例进行了简化 @(Html.Kendo().Grid<LeagueViewModel>(Model.Leagues) .Name("grid_#=LeagueTypeId#") .Columns(columns => { }) .ToolBar(toolbar => { toolbar.Create().Tex

我有一个剑道MVC层次结构网格。为了便于阅读,我的示例进行了简化

            @(Html.Kendo().Grid<LeagueViewModel>(Model.Leagues)
        .Name("grid_#=LeagueTypeId#")
        .Columns(columns => { })
        .ToolBar(toolbar =>
        {
            toolbar.Create().Text("Add New League(Window)");
        })
        .Editable(editable => editable.Mode(GridEditMode.PopUp)
            .TemplateName("LeagueEdit")
            .Window(w =>
            {
                w.Position(p => p.Top(200)); // position not working, need to center more vertically
                w.Width(800);
            }
                            )
                        )
        .Events(e => e.Edit("leagueEdit"))
        .DataSource(dataSource => dataSource
            .Server()
            .Model(model =>
            {
                model.Id(p => p.LeagueID);
                model.Field(l => l.strSportId).DefaultValue("#=SportId#"); // set default value with parent grid data
                model.Field(l => l.strLeagueTypeId).DefaultValue("#=LeagueTypeId#"); // set default value with parent grid data
            }
            )
            .Read(read => read.Action("Bound_League_Read", "Configuration", new { _leagueTypeId = "#=LeagueTypeId#" }))
            .Create(create => create.Action("League_Create", "Configuration"))
        )
            )
LeagueEdit.cshtml 当弹出模板打开时,模型没有数据。如何将数据导入模型?我在弹出编辑器中有需要父网格值的元素

        <p>sport: @Model.SportId</p> <!-- value does not carry over -->
        <p>leaguetype: @Model.LeagueTypeId</p>  <!-- value does not carry over -->  
sport:@Model.SportId

leaguetype:@Model.LeagueTypeId


在编辑事件中,尝试使用其Id在弹出窗口中查找控件并设置值。例如,在下面的代码中,我在弹出窗口中找到一个日期选择器,并将其值设置为model属性

function LeagueEditEdit(e) {
    var val1 = e.container.find("input[name=CallDate]").data("kendoDatePicker");
    val1.value($('#CallDate').attr('value'));
    e.model.CallDate = val1._value;
}
function LeagueEditEdit(e) {
    var val1 = e.container.find("input[name=CallDate]").data("kendoDatePicker");
    val1.value($('#CallDate').attr('value'));
    e.model.CallDate = val1._value;
}