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

Grid Update/Edit

1 Answer 82 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Dennis
Top achievements
Rank 1
Dennis asked on 21 Nov 2012, 09:48 PM
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

1 Answer, 1 is accepted

Sort by
0
Chrys
Top achievements
Rank 1
answered on 08 Aug 2013, 04:50 PM
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.
Tags
Grid
Asked by
Dennis
Top achievements
Rank 1
Answers by
Chrys
Top achievements
Rank 1
Share this question
or