GridEditMode.PopUp Editing Problems MVC 6

2 posts, 0 answers
  1. fran
    fran avatar
    1 posts
    Member since:
    Jan 2016

    Posted 22 Jan Link to this post

    hi, im using 5 with MVC 6 and i have 2 problem using GridEditMode.PopUp

    ----------------------------------------------------- view ----------------------------------------------------------------------------

     @(Html.Kendo().Grid<Organization>()  .Name("grid")

    .Columns(columns =>             {                

     columns.Bound(p => p.Name).Title("Name");

    columns.Bound(p => p.Email).Title("Email");

     columns.Bound(p => p.Disabled).Title("Disabled").Width(120);                         columns.Command(command => { command.Edit(); command.Destroy(); }).Width(150);             })

    .HtmlAttributes(new { style = "height: 550px;" })             

    .ToolBar(toolbar => toolbar.Create().Text("Add"))             

    .Editable(editable =>{ editable.Mode(GridEditMode.PopUp); editable.TemplateName("Edit"); })             

    .Pageable( pageable => pageable .Input(false) .Numeric(false) ) .Filterable().Sortable().Scrollable()          .Events(events => events.Edit("insertPopupCaption"))             

    .DataSource(dataSource => dataSource.Ajax().PageSize(11).Events(events => events.Error("grid_error"))

    .Model(model =>  {                        

     model.Id(p => p.Id);                         

    model.Field(p => p.Name).Editable(false);

    model.Field(p => p.Email).Editable(true);                         

    model.Field(p => p.Disabled); })

    .Create(update => update.Action("Create", "Organization"))

    .Read(read => read.Action("GetAll", "Organization"))                

     .Update(update => update.Action("Update", "Organization"))                 

    .Destroy(update => update.Action("Delete", "Organization"))     )             )



     1- As you can see im using editable.TemplateName("Edit") but this template is never found in the path "/view/Organization/EditorTemplates/Edit.cshtml" the only way to make it works is using the template in the path  "/view/Shared/EditorTemplates/Edit.cshtml" (i have seen projects with mvc5 and this problem never happens)


    2- if i try to remove the tag editable.TemplateName("Edit");  tring to use the template by default, this template seems to dont have in account the model because  the field NAME "model.Field(p => p.Name).Editable(false);" is set to as not edittable BUT IN THE POPUP IT CAN BE EDITTABLE...


     Thanks for your help...



  2. Rosen
    Rosen avatar
    3215 posts

    Posted 26 Jan Link to this post

    Hello fran,


    Straight to your questions:


    - I'm afraid that I'm not sure what may be causing this issue. Could you please provide a small runnable sample which demonstrate the described behavior. This will allow us to further investigate your case.


    - Regarding your second question. As you may know the popup edit form uses Html.EditorForModel in order to create the actual edit form template. Thus, there is no way to "externally" influence which field will be rendered as readonly via the DataSource's Model settings. In order to mark any Model property you should use "the standard" way as with any other ASP.NET MVC editor - for example decorating the property with the ReadOnlyAttribute.  


    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  3. UI for ASP.NET AJAX banner
Back to Top