New to Telerik UI for ASP.NET MVC? Download free 30-day trial

Creating Action Without Update Button in a Grid Command Column


Product Grid for Progress® Telerik® UI for ASP.NET MVC


I have a grid where I only need Create, Read and Destroy actions. However, if I have no command.Edit(); in the c.Command, then there is no way to create a record.

If I add the command.Edit();, then it throws an error, saying I need to hook up an Update method.

How do I fix this?


It is possible to achieve the desired behavior by providing a custom save button and making it visible only when the edited model is new.

Here is one way of achieving the desired result:

  1. Add a custom command button. You may use the IconClass() to get it to look like the built-in save buttons:

        columns.Command(c =>
            c.Custom("Save").Click("saveRow").IconClass("k-icon k-i-check").Visible     ("shouldBeVisible");
  2. Add the click handler which will save the row and trigger the create action:

        function saveRow(e) {
            // is the DOM element representing the button
            var tr = $("tr");
  3. Set the visibility of the custom button to true only for new models:

        function shouldBeVisible(e) {       
            return e.isNew();

More ASP.NET MVC Grid Resources

See Also

In this article