MVC Grid modal edit item

2 posts, 0 answers
  1. Andrés
    Andrés avatar
    6 posts
    Member since:
    Aug 2015

    Posted 24 Sep 2015 Link to this post


    I'm working with telerik grid and using a custom modelview element to pass the data to the controller, when the user presses the Edit button inside the grid it should display the modelview item information or at least the information I want it to show, but so far just errors and an inconsistent look and feel when I use telerik controllers,

    I've configured the Edit command to only show all fields of my viewmodel except the item id, but every time it keeps showing the item id,  

    This is my modelview item class 

    public class EmpleadoViewModel
           public int EmpleadoID { get; set; }
            public String Nombre { get; set; }
            public String Email { get; set; }
            public String Activo { get; set; }
            public String Role { get; set; }

     This is the grid settings 

                   .Columns(columns =>
                       columns.Bound(e => e.Nombre).Title("Nombres").HeaderHtmlAttributes(new { style = "text-align:center" });
                       columns.Bound(e => e.Email).Title("E-Mail").HeaderHtmlAttributes(new { style = "text-align:center" });
                       columns.Bound(e => e.Activo).Title("Estado").HeaderHtmlAttributes(new { style = "text-align:center" });
                       columns.Bound(e => e.Role).Title("Rol de sitio").HeaderHtmlAttributes(new { style = "text-align:center" });
                       columns.Command(command =>
                           command.Edit().Text("Editar").HtmlAttributes(new { @class = "sharp", onmouseover = "editBtnPopover(this)", onmouseout="hidePopover(this)" });
                           command.Custom("Deshabilitar").Click("disablePerson").HtmlAttributes(new { @class = "sharp", onmouseover = "disableBtnPopover(this)", onmouseout = "hidePopover(this)" });
                       }).Title("Acciones").HeaderHtmlAttributes(new { style = "text-align:center" });
                   .ToolBar(toolbar =>
                       toolbar.Create().Text("Nuevo").HtmlAttributes(new { id="new_btn" });
                   .HtmlAttributes(new { style = "height:550px;" })
                   .Editable(editable =>
                       editable.Mode(GridEditMode.PopUp).Window(window =>
                           window.Title("ICS: Personas");
                   .Pageable(pageable =>
                   .Events(events => events.Change("getSelectedItem"))
                   .DataSource(dataSource => dataSource
                       .Model(model =>
                           model.Id(emp => emp.EmpleadoID);
                           model.Field(emp => emp.EmpleadoID).Editable(false);
                       .Create(update => update.Action("EditingPopup_Create", "Grid"))
                       .Read(read => read.Action("Read_Alpes_Employees", "Demo"))
                       .Update(update => update.Action("EditingPopup_Update", "Grid"))
                       .Destroy(update => update.Action("EditingPopup_Destroy", "Grid"))

     So far I'm very unhappy with your product, I can't modify certain things and also every time I use telerik it  messes my whole page design!!!! 


  2. Boyan Dimitrov
    Boyan Dimitrov avatar
    2033 posts

    Posted 28 Sep 2015 Link to this post

    Hello Andrés,

    I am sorry to hear that you have negative experience using our product. 

    Unfortunately setting the Editable(false) option in the model configuration will not hide the input field for this property in the popup editor. In order to achieve the desired functionality please use custom popup template. Please refer to the Custom popup editor article that shows how to customize the popup editor of the Grid when the mode is configured to be "popup".


    Boyan Dimitrov
    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
Back to Top