弹出编辑器中的Telerik MVC网格层次下拉列表

时间:2016-02-22 13:41:53

标签: c# telerik telerik-grid hierarchical-data telerik-mvc

我的应用中有一个Telerik MVC网格:

@(Html.Kendo().Grid<SkillCardViewModel>()
                  .Name("grid")
                  .Columns(columns =>
                  {
                      columns.Bound(p => p.ID).Width("5%");
                      columns.Bound(p => p.LastModified).Visible(false).Width("15%");
                      columns.ForeignKey(p => p.EmployeeID, new SelectList((IEnumerable)ViewData["employees"], "ID", "Login")).Title("Employee").Width("25%");
                      columns.ForeignKey(p => p.SkillCategoryID, new SelectList((IEnumerable)ViewData["skillcategories"], "ID", "Name")).Title("Skill Category").Width("25%");
                      columns.ForeignKey(p => p.SkillID, new SelectList((IEnumerable) ViewData["skills"], "ID", "Name")).Title("Skill").Width("25%");
                      columns.ForeignKey(p => p.RatingID, new SelectList((IEnumerable)ViewData["ratings"], "ID", "Name")).Title("Rating").Width("15%");
                      columns.Command(command =>
                      {
                          command.Edit();
                          command.Destroy();
                      }).Width("15%");
                  })
                  .ToolBar(toolbar =>
                  {
                      toolbar.Create();
                      toolbar.Excel();
                  })
                  .Editable(editable => editable.Mode(GridEditMode.PopUp))
                  .Pageable()
                  .Sortable()
                  .Scrollable()
                  .Groupable(groupable => groupable.Enabled(true))
                  .Filterable(x =>
                  {
                      x.Enabled(true);
                      x.Mode(GridFilterMode.Menu);
                  })
                  .Excel(excel => excel
                      .FileName("CTG_ScoreCard.xlsx")
                      .Filterable(true)
                  )
                  .HtmlAttributes(new { style = "height:430px;" })
                  .DataSource(dataSource => dataSource
                      .Ajax()
                      .PageSize(20)
                              .Events(events =>
                                      {
                                          events.Error("error_handler");
                                          events.RequestEnd("requestend_handler");
                                      })
                      .ServerOperation(true)
                      .Model(model =>
                      {
                          model.Id(p => p.ID);
                          model.Field(p => p.ID).Editable(false);
                          model.Field(p => p.SkillCategoryID).Editable(true);
                          model.Field(p => p.SkillID).Editable(true);
                          model.Field(p => p.LastModified).Editable(false);
                          model.Field(p => p.RatingID).Editable(true);
                      })
                      .Create(create => create.Action("SkillCard_Create", "Scorecard", new { area = "Scorecard", @id = ViewBag.EmployeeID }))
                      .Read(read => read.Action("SkillCard_Read", "Scorecard", new { area = "Scorecard", @id = ViewBag.EmployeeID }))
                      .Update(update => update.Action("SkillCard_Update", "Scorecard", new { area = "Scorecard", @id = ViewBag.EmployeeID }))
                      .Destroy(destroy => destroy.Action("SkillCard_Destroy", "Scorecard", new {area = "Scorecard", @id = ViewBag.EmployeeID}))
                  )
            )

screenview 现在这些是独立的,这是错误的。

数据正在正确加载到网格中,当我尝试创建或编辑记录时,我希望Skill Category下拉列表过滤掉Skills记录,因此只有所选类别的技能。我怎样才能做到这一点?

0 个答案:

没有答案