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

DropdownList custom editor won't appear in popup edit mode

3 Answers 222 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Bob
Top achievements
Rank 1
Bob asked on 15 Jan 2014, 05:05 PM
When trying to edit a simple object that is part of my model in a grid in popup edit mode the dropdownlist editor doesn't appear.  It does appear when the grid is in inline edit mode.  Below is the relevant code snippets from a sample project I created to reproduce this behavior.  I can attach the sample project if need be.

public class OrderModel
    {
        public int OrderNumber { get; set; }
        public int Quantity { get; set; }
        public string Item { get; set; }
        [UIHint("SupplierEditor")]
        public SupplierModel Supplier { get; set; }
    }

    public class SupplierModel
    {
        public int SupplierID { get; set; }
        public string SupplierName { get; set; }
    }


@model KendoUIMvcApplication2.Models.SupplierModel

@(Html.Kendo().DropDownList().Name("cboSupplier")
        .DataTextField("SupplierName")
        .DataValueField("SupplierID")
        .DataSource(d => d
            .Read("GetSuppliers", "Home")
            )
        )

@(Html.Kendo().Grid<KendoUIMvcApplication2.Models.OrderModel>().Name("gridOrdersPopup").Columns(c =>
    {
        c.Bound(model => model.OrderNumber).Title("Order #");
        c.Bound(model => model.Item);
        c.Bound(model => model.Quantity);
        c.Bound(model => model.Supplier).ClientTemplate("#= Supplier.SupplierName #");
        c.Command(command => { command.Edit(); command.Destroy(); });
    })
    .DataSource (d => d
        .Ajax()
        .ServerOperation(false)
        .Read(read => read.Action("GetOrders", "Home"))
        .Create(update => update.Action("CreateOrder", "Home"))
        .Update(update => update.Action("UpdateOrder", "Home"))
        .Destroy(update => update.Action("DeleteOrder", "Home"))
        .Model(model => model.Id(m => m.OrderNumber))
        )
    .Editable(editable => editable.Mode(GridEditMode.PopUp))
    .ToolBar(toolbar => toolbar.Create())
    .Selectable(s => s.Mode(GridSelectionMode.Single))
    .Sortable()
    .Scrollable(s => s.Height(200))
    .Resizable(resize => resize.Columns(true))
    )

3 Answers, 1 is accepted

Sort by
0
Vladimir Iliev
Telerik team
answered on 17 Jan 2014, 09:10 AM
Hi Bob,

I tried to reproduce the problem locally but to no avail – everything is working as expected on our side. Could you please provide runable project where the issue is reproduced? This would help us pinpoint the exact reason for this behavior.

Regards,
Vladimir Iliev
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Bob
Top achievements
Rank 1
answered on 17 Jan 2014, 12:49 PM
Attached is my sample project.  Two grids that load the same data, but one edits in popup mode and the other inline.  In pop-up mode the supplier editor doesn't appear.
0
Vladimir Iliev
Telerik team
answered on 17 Jan 2014, 02:22 PM
Hi Bob,

Apologize that I mislead you  - while I testing the Grid code that you provide on our side I didn't notice that you are using nested object. Basically the PopUp template of the Grid uses the EditorForModel MVC helper to generate the template, which indeed doesn't support complex properties. That why in current case you should implement custom PopUp editor template.

Also please note that our CodeLibrary already contains such demo which you can use as a baseline:

Regards,
Vladimir Iliev
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
Bob
Top achievements
Rank 1
Answers by
Vladimir Iliev
Telerik team
Bob
Top achievements
Rank 1
Share this question
or