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

Kendo popup editor not working if in different folder

2 Answers 278 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Jithu
Top achievements
Rank 1
Jithu asked on 20 Apr 2017, 07:41 AM

Hi,

I'm facing an issue with popup of a Kendo MVC grid.

The Popup renders a custom "EditData.cshtml" view which is under the following folder structure--> Views/My/EditorTemplates/EditData.cshtml

But if I move the EditorTemplates folder to another folder say "controls" (eg; Views/My/Controls/EditorTemplates/EditData.cshtml), the EditData.cshtml template view is not found by the pop-up and renders the default popup.

The "EditData.cshtml" is also found if I move the Editortemplates folder to the Shared folder (Shared/EditorTemplates/EditData.cshtml).

I want to place the EditorTemplates under the Controls folder in this structure --> Views/My/Controls/EditorTemplates/EditData.cshtml

Any help would be highly appreciated:

Below is the sample Grid :

   @(Html.Kendo().Grid<MyViewModel>()
        .Name("aliasGrid")      
        .Columns(columns =>
        {
        columns.Bound(c => c.AccountNumber).Title("Account No").Width(30);
        columns.Bound(c => c.Identifier).Title("Identifier").Width(40);
        columns.Bound(c => c.Name).Title("Alias Name");
        columns.Bound(c => c.Status.DisplayName).Title("Status/Reason");
        columns.Template(@<text></text>).ClientTemplate(@"<a class='k-grid-edit' ><u>Edit</u></a>").Title("Action");

        })       
        .Editable(x => x.Mode(GridEditMode.PopUp).TemplateName("EditData").Window(y=>y.Animation(false)))  //rendering a view from the EditorTemplates folder          
        .Groupable()
        .Sortable()
        .Filterable()
        .Pageable(pageable => pageable
        .Refresh(true)
        .PageSizes(true)
        .ButtonCount(5))       
        .Events(e => e.Edit("CheckAccess"))        
        .DataSource(dataSource => dataSource
            .Ajax()           
            .Read(read => read.Action("GetData", "My").Data("GetMemberNo")) 
            .Update(update => update.Action("UpdateData", "My"))
            .PageSize(10)
            .Model(model => model.Id(p => p.ID))
            )            
        )

 

2 Answers, 1 is accepted

Sort by
0
Jithu
Top achievements
Rank 1
answered on 20 Apr 2017, 07:47 AM

Seems like the Popup is going by the MVC folder naming conventions.. It's looking for Views/<ControllerName>/EditorTemplates/<ViewName>.cshtml

Is there a way to change this behaviour of kendo grid pop-up?

 

0
Accepted
Viktor Tachev
Telerik team
answered on 21 Apr 2017, 01:26 PM
Hi Jithu,

When you specify custom editors they must be placed in the EditorTemplates folder. This is the convention used in MVC and it is also used with the Kendo components. 

For more information on the matter please refer to the following stackoverflow thread:



Regards,
Viktor Tachev
Telerik by Progress
Try our brand new, jQuery-free Angular 2 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
Jithu
Top achievements
Rank 1
Answers by
Jithu
Top achievements
Rank 1
Viktor Tachev
Telerik team
Share this question
or