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

can not get property template to show for grid popup editor

2 Answers 154 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Terence
Top achievements
Rank 1
Terence asked on 22 Jan 2013, 11:26 AM
Hi,

I am using mvc kendo ui grid:
                    @(Html.Kendo().Grid<PortalUser>(Model.GetUsers())
                    .Name("Grid")
                    .Columns(columns =>
                    {
                        columns.Bound(p => p.ID).Width(200);                    
                        columns.Bound(p => p.UserName).Width(250);
                        columns.Bound(p => p.Password).Visible(false);
                        columns.Bound(p => p.Email).Width(250);
                        columns.Bound(p => p.Role.Name).Width(200).Title("Role");
                        columns.Bound(p => p.Comment).Width(300);
                        columns.Bound(p => p.IsLockedOut).Title("Locked").Width(100);
                        columns.Command(command => { command.Edit(); }).Width(100);
                        columns.Command(command => { command.Destroy(); }).Width(100);

                    })
                     .ToolBar(toolbar => toolbar.Create())
                     .Editable(editable => editable.Mode(GridEditMode.PopUp))
                    .Pageable()
                    .Sortable()
                    .Scrollable()
                    .Filterable()
                    .Selectable(selectable => selectable.Mode(GridSelectionMode.Single))
                        .DataSource(dataSource => dataSource
                            .Ajax()
                            .Batch(false)
                            .ServerOperation(false)
                             .PageSize(50)
                             .Create(update => update.Action("Users_Create", "Membership"))
                            .Read(read => read.Action("Users_Read", "Membership").Data("FilterUsers"))
                            .Destroy(update => update.Action("Users_Delete", "Membership"))
                            .Update(update => update.Action("Users_Edit", "Membership"))
                            .Model(model =>
                                {
                                    model.Id(m => m.ID);
                                    model.Field(m => m.ID).DefaultValue(new Guid());
                                    model.Field(m => m.Role).DefaultValue(new PortalRole { RoleID = Guid.NewGuid(), Name = "no role" });
                                })
                        )
                        .HtmlAttributes(new { style = "height:500px" })
                )

I want the Role field to display as dropdown in the popup editor. So i have created a template file called RoleEditor.cshtml in Views\Shared\EditorTemplates.

I have also added the decoration attribute 
        [UIHint("RoleEditor")]
        public PortalRole Role { get; set; }
to the model class
I have followed all the steps given in your documentation:
http://docs.kendoui.com/getting-started/using-kendo-with/aspnet-mvc/helpers/grid/editor-template
and yet it does not work.



2 Answers, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 24 Jan 2013, 07:46 AM
Hello Terence,

In PopUp editing the Grid uses the EditorForModel helper to generate the template which by default does not render the editors for complex types. You could either use custom popup template as demonstrated in this code library or override the MVC default object template.

Regards,
Daniel
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Dilip
Top achievements
Rank 1
answered on 01 May 2013, 05:24 PM
Dainel,

Could you please let me know how to bind dropdownlist for grid popup editor using JQuery and MVC (not using kendo dll).

Will be great if you can share any example.

Regards,
Dilip
Tags
Grid
Asked by
Terence
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Dilip
Top achievements
Rank 1
Share this question
or