Kendo popup editor not working if in different folder

3 posts, 1 answers
  1. Jithu
    Jithu avatar
    2 posts
    Member since:
    Feb 2017

    Posted 20 Apr Link to this post

    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. Jithu
    Jithu avatar
    2 posts
    Member since:
    Feb 2017

    Posted 20 Apr in reply to Jithu Link to this post

    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?

     

  3. Answer
    Viktor Tachev
    Admin
    Viktor Tachev avatar
    1727 posts

    Posted 21 Apr Link to this post

    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.
Back to Top