Grid Update/Edit

2 posts, 0 answers
  1. Dennis
    Dennis avatar
    38 posts
    Member since:
    Aug 2012

    Posted 21 Nov 2012 Link to this post

    Can someone please help me with this. I've asked a few times and I just can't believe I'm the only one who has encountered this. I have never created a form where the same fields I'm editing are the same fields I'm inserting. It appears the kendo grid uses the same template to display the edit and the insert fields. Example: I may way to insert a status but not be able to update it. Again, i never came across an application I have developed where the same fields are used for both an insert and an update..

    I used a template but again it keeps firing the same template for the edit and update. Frustrating, please help.

    @(Html.Kendo().Grid(Model)
            .Name("Grid")
        .Columns(columns =>
        {
            columns.Bound(p => p.CodeID);
            columns.Bound(p => p.CodeDescription);
            columns.Bound(p => p.Title);
            columns.Bound(p => p.Status).Filterable(false);
            columns.Command(command => command.Edit()).Width(200);
            
        })
        .ToolBar(toolBar => toolBar.Create().Text("Add New Code"))
        
        .Sortable()
        .Scrollable()
        .Pageable()
        .Filterable()
        .Selectable(selectable => selectable.Mode(GridSelectionMode.Single))
        .Resizable(resize => resize.Columns(true))
        .DataSource(dataSource => dataSource
            .Ajax()
            .Events(events => events.Error("error_handler"))
            .ServerOperation(false)
            
            .Model(model => model.Id(p => p.CodeID))
              .Update(update => update.Action("Edit", "CodeManager", new { classifications = @ViewBag.SelectedCatgory }))
              .Create(create => create.Action("Create", "CodeManager", new { classifications = @ViewBag.SelectedCatgory }))
                                    )
              .Editable(ed => ed.Mode(GridEditMode.PopUp).TemplateName("_CodeEditor"))
            )

    thanks
    dennis

  2. Chrys
    Chrys avatar
    45 posts
    Member since:
    Feb 2013

    Posted 08 Aug 2013 Link to this post

    I don't know if your question has been answered or not but have checked to make sure that _CodeEditor partial view is either in the Shared->EditorTemplates folder or in Views-><ControllerViewFolder>->EditorTemplates.  I've attached an image of how it needs to be if your want your partial view inside a controller views folder. If you do not put your partial views in a folder name EditorTemplates the kendo grid will not be able to find it.

Back to Top