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

Calling MVC Controller Actions from Grid

1 Answer 1075 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Chris
Top achievements
Rank 1
Chris asked on 19 Sep 2019, 04:29 PM
How do I call my MVC Core Controller Actions for Create, Update, and Delete from the Grid and Grid Rows.  My previous version used the following code, but the new Core version does not work:

c.Bound(m => m.DeliveryDocumentNumber).ClientTemplate(Html.ActionLink("Edit", "Edit", "Orders", new { id = "#=Id#" },     null).ToString()).Title("").Filterable(false).IncludeInMenu(false);
c.Bound(m => m.DeliveryDocumentNumber).ClientTemplate(Html.ActionLink("Details", "Details", "Orders", new { id = "#=Id#" }, null).ToString()).Title("").Filterable(false).IncludeInMenu(false);

c.Bound(m => m.DeliveryDocumentNumber).ClientTemplate(Html.ActionLink("Delete", "Delete", "Orders", new { id = "#=Id#" }, null).ToString()).Title("").Filterable(false).IncludeInMenu(false);

I want to use the Controller Views for CRUD operations and not the Grid since the Grid only shows a subset of the data.

Thanks.

1 Answer, 1 is accepted

Sort by
0
Eyup
Telerik team
answered on 20 Sep 2019, 12:37 PM

Hi Chris,

 

I've already provided a reply in the support thread, but I will also paste the answer here so other developers might find it useful as well:

 

"There are several ways of achieving this requirement. You can find them with working samples in the following posts:

https://stackoverflow.com/a/38089090/6509119

https://stackoverflow.com/a/44436506/6509119

https://www.telerik.com/forums/mvc-grid-custom-command-to-call-actionlink-with-parameter-from-grid

 

And if you want to call only a client-side function instead of Controller Action, you can use the Click() event:

https://demos.telerik.com/aspnet-core/grid/custom-command"

Regards,
Eyup
Progress Telerik

Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
Grid
Asked by
Chris
Top achievements
Rank 1
Answers by
Eyup
Telerik team
Share this question
or