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

MVC Grid modal edit item

1 Answer 373 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Andrés
Top achievements
Rank 1
Andrés asked on 25 Sep 2015, 04:46 AM

Hi, I've been working with telerik mcv grid, i've used a modelview to pass the data to the controller. Now i want the user to be available to edit the row information but every time the user presses the edit button on the grid the modal window shows the item id which is not suposed to be displayed

 This is the modelview 

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

 

 This is the grid config

@(Html.Kendo().Grid<EmpleadoViewModel>()
               .Name("people_grid")
               .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.Draggable(false);
                       window.Title("ICS: Personas");
                   }))
               .Scrollable()
               .Sortable()
               .Pageable(pageable =>
               {
                   pageable.Refresh(false);
                   pageable.PageSizes(true);
                   pageable.ButtonCount(5);
               })
                
               .Events(events => events.Change("getSelectedItem"))
               .DataSource(dataSource => dataSource
                   .Ajax()
                    
                   .PageSize(10)
                   .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"))
               )
           )

 

1 Answer, 1 is accepted

Sort by
0
Boyan Dimitrov
Telerik team
answered on 28 Sep 2015, 12:59 PM

Hello Andrés,

 

Please refer to http://www.telerik.com/forums/mvc-grid-modal-edit-item forum thread, where an answer to the same question is posted. 

 

Regards,
Boyan Dimitrov
Telerik
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
Tags
Grid
Asked by
Andrés
Top achievements
Rank 1
Answers by
Boyan Dimitrov
Telerik team
Share this question
or