【问题标题】:Custom Editor Template not working for Kendo UI for ASP.NET Core Scheduler widget自定义编辑器模板不适用于 ASP.NET Core Scheduler 小部件的 Kendo UI
【发布时间】:2018-01-08 16:07:19
【问题描述】:

我在 ASP.NET Core MVC Web 应用程序中使用 Kendo UI for ASP.NET Core。

我关注this example 为我的 Kendo UI Scheduler 使用自定义编辑器模板。

我确保我的 EventViewModel 实现了 ISchedulerEvent。

我创建了一个编辑器模板(带 EventViewModel),就像他们在 Views/Events/EditorTemplates/CustomEditorTemplate.cshtml 下所做的一样。 (我从简单的 2 个字段开始,以确保它有效)。

@model EventViewModel
    @{
        //required in order to render validation attributes
        ViewContext.FormContext = new FormContext();
    }

    <div class="row">
        <div class="col-md-12">
            <div class="form-group">
                <label asp-for="Title" class="control-label"></label>
                <input asp-for="Title" class="form-control" />
                <span asp-validation-for="Title" class="text-danger"></span>
            </div>
            <div class="form-group">
                <label asp-for="Description" class="control-label"></label>
                <input asp-for="Description" class="form-control" />
                <span asp-validation-for="Description" class="text-danger"></span>
            </div>
            <div class="form-group">
                <input type="submit" value="Save" class="btn btn-default" />
            </div>
        </div>
    </div>

    @{
        ViewContext.FormContext = null;
    }

我还创建了一个视图来放置调度程序(w/EventViewModel)本身: 视图/事件/Index.cshtml:

@(Html.Kendo().Scheduler<EventViewModel>()
      .Name("scheduler")
      .Height(600)
      .Views(views => {
          views.DayView();
          views.WeekView(weekView => weekView.Selected(true));
          views.MonthView();
          views.AgendaView();
      })
      .Editable(editable => {
          editable.TemplateName("CustomEditorTemplate");
      })
      .Timezone("Etc/UTC")
      .DataSource(d => d
          .Model(m => {
              m.Id(f => f.Id);
              m.Field(f => f.Title).DefaultValue("No title");
          })
          .Read("Events_Read", "Events")
          .Create("Events_Create", "Events")
          .Destroy("Events_Destroy", "Events")
          .Update("Events_Update", "Events")
      )
      )

我指定的 CustomEditorTemplate 被完全忽略。我最终得到一个窗口,其中包含 ISchedulerEvent 拥有的每个字段。这还不适用于 ASP.NET Core MVC 吗?

【问题讨论】:

    标签: c# asp.net-core kendo-ui telerik kendo-ui-mvc


    【解决方案1】:

    正如您在 this thread 中看到的,此行为不支持开箱即用。

    您可以自己处理双击事件以打开与调度程序无关的弹出窗口。你可以看一个例子here

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-09-26
      • 2014-05-31
      • 1970-01-01
      • 1970-01-01
      • 2021-03-20
      相关资源
      最近更新 更多