【问题标题】:How to populate Kendo.ComboBox with ajax?如何使用 ajax 填充 Kendo.ComboBox?
【发布时间】:2019-05-14 14:10:55
【问题描述】:

我在Editor Template 中定义了一个Kendo.ComboBox

当 Kendo.Grid 被填充时,这个模板在索引页面中被引用:

co.Bound(c => c.Name).Title("Property Name").EditorTemplateName("_MyEditor");

这是组合框:

@(Html.Kendo().ComboBox()
          .Name("ReportProperty")
          .DataTextField("PropertyName")
          .DataValueField("ReportPropertyID")
          .HtmlAttributes(new { id = "idCB" })
)

有一个事件触发,我想使用 Ajax 调用来填充这个 Kendo.ComboBox。

我不想将.DataSource 与 Action 调用一起使用,我尝试过但在我的情况下不起作用,所以我想在特定事件上使用Ajax

这样做的正确方法是什么?

【问题讨论】:

    标签: ajax telerik-mvc kendo-combobox editortemplates


    【解决方案1】:

    尝试如下:

    @(Html.Kendo().ComboBox()
              .Name("ReportProperty")
              .DataTextField("PropertyName")
              .DataValueField("ReportPropertyID")
              .HtmlAttributes(new { id = "idCB" })
              .DataSource(source => {
                 source.Read(read =>
                 {
                     read.Action("Action", "Controller");
                 })
          })
    )
    

    【讨论】:

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