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

Master detail grid - need to populate column with dropdown list which change dynamically in detail grid

1 Answer 180 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Sherly
Top achievements
Rank 1
Sherly asked on 14 Aug 2013, 09:37 AM
Hi,

I have a master detail grid. The detail grid has a column which needs to be populated with a dropdown that contains values which change depending on the master row selected.

I tried using an editor template as shown below, but the data does not get populated in the drop down:

<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<MyProject.Models.ProductParentHierViewModel>" %>

<%:Html.Kendo().DropDownListFor(d => d)
                .Name("ProductParentHier")
                .OptionLabel("Select")
                .DataValueField("ProductID")
                .DataTextField("ProductHier")
                  .DataSource(source =>
                  {
                      source.Read(read =>
                      {
                          read.Action("GetProductHier", "Product", new { ProductVersionID = "#=ProductParentVersion.ProductParentID#" });
                      });
                  })
 %>


How would I achieve this?

Thanks,

Sherly

1 Answer, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 16 Aug 2013, 08:41 AM
Hello,

You should use the request Data function to get the needed value and pass it with the request:

<script>
function additionalData(){
    return {
        ProductVersionID: SelectedMasterRowID
    };
}
</script>
<%:Html.Kendo().DropDownListFor(d => d)
.Name("ProductParentHier")
.OptionLabel("Select")
.DataValueField("ProductID")
.DataTextField("ProductHier")
  .DataSource(source =>
  {
      source.Read(read =>
      {
          read.Action("GetProductHier", "Product").Data("additionalData");
      });
  })
 %>
The editor is not a template so the expression will not be evaluated. Regards,
Daniel
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
Grid
Asked by
Sherly
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Share this question
or