This is a migrated thread and some comments may be shown as answers.

EditTemplate with DropDownList

1 Answer 273 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Robert Madrian
Top achievements
Rank 1
Veteran
Iron
Robert Madrian asked on 18 Jan 2018, 06:37 PM

Hello,

Isn't it possible to use a Kendo DropDownList in the Grid EditTemplate and pass the Parameter for the Dropdown with the Kendo Template Syntax like this: new {mitgliedid = "#: Mitglied_ID #"}

Here a example:

@(Html.Kendo().DropDownList()
      .Name("products")
      .DataTextField("ProductName")
      .DataValueField("ProductID")
      .DataSource(dataSource => { dataSource.Read(read => read.Action("Lookup", "Berechtigung", new {mitgliedid = "#: Mitglied_ID #"}))
          .ServerFiltering(true); })
          .ToClientTemplate()
      )

 

or is the only way to pass that parameter in the Grid Edit Event (e.model)?

robert

1 Answer, 1 is accepted

Sort by
0
Konstantin Dikov
Telerik team
answered on 23 Jan 2018, 12:30 PM
Hi Robert,

This syntax could not be used within the editor template for passing additional data, but you can take a look at the following HowTo example, where the Data function is used for returning additional parameters:
In the editor template:
...
 dataSource.Read(read => read.Action("GetVendors", "Home").Data("filterVendors"))

And in the main view:
function getCurrentEditedModel() {
      var grid = $("#Grid").data("kendoGrid");
      var editRow = grid.tbody.find("tr:has(.k-edit-cell)");
      return grid.dataItem(editRow);
  }
 
  function filterVendors() {
      var model = getCurrentEditedModel();
      return {
          customerId: model.CustomerId
      };
  }

Hope this helps.


Regards,
Konstantin Dikov
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
Grid
Asked by
Robert Madrian
Top achievements
Rank 1
Veteran
Iron
Answers by
Konstantin Dikov
Telerik team
Share this question
or